[LLVMdev] Propagate clang attribute to IR

Rinaldini Julien julien.rinaldini at heig-vd.ch
Tue Mar 24 06:48:44 PDT 2015


I want to *tag* some functions with some *flags*. I was using annotate((“myFlag”)) and everything was working fine until I tried on ObjC method. It seems that clang just ignore it.

So, to be able to *flag* my functions I’m trying to add a *real* attribute to clang.

I’ve added a new attribute to clang in tools/clang/include/clang/Basic/Attr.td:

def NoFLA : Attr {
  let Spellings = [GNU<"nofla">, CXX11<"gnu", "nofla">];

In tools/clang/lib/Sema/SemaDeclAttr.cpp I added my new attribute to the switch that handle it and created my own handler function.
I’m trying to simply pass my attribute to the IR attribute list, but, sadly, I have absolutely no idea how to do that. I looked at others handler but none seems to do that. I also tried to use handleSimpleAttribute, but it doesn’t work either.

Any idea how to do that (or enable annotate on ObjC method)?


More information about the llvm-dev mailing list