Naveed Ul Mustafa via llvm-dev
2016-Nov-17 09:28 UTC
[llvm-dev] Code generation for custom attribute
Hi All, I am kind of begginer in using llvm. I need to add the custom attribute in clang and then generate custom code for delcaration having that attribute. I have succesfully added my custom attributed to clang by following the tutorial (http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute). Now I can use my attribute for example __attribute__((myAttr(1))) unsigned int a, b; and it doesnt give any warning. I have also added a handle function in SemaDeclAttr.cpp with following defination. static void handleMyAttr(Sema &S, Decl *D, const AttributeList &Attr) { if (D->hasAttr<myAttrAttr>()) { //Not sure what to do here } } I need your advice/help on how I can use this custom attribute to generate custom code for variable having myAttr (for example int a, b as mentioned above). Thanks in advance for any help. -- Naveed Ul Mustafa