CodeGen and AnnotateAttr objects

I’m trying to figure out how Clang’s CodeGen deals with AnnotateAttr objects. The only uses of “AnnotateAttr” I can find in the CodeGen directory seem to point to CodeGenModule::EmitAnnotateAttr(). The comment here seems to imply that this function will only handle AnnotateAttrs on GlobalValues.

How/where does it handle AnnotateAttrs on VarDecls, or even regular Decls? I’m asking because I have added some AnnotateAttrs to VarDecls in a plugin, had that plugin write out its AST file and then let clang compile it(with -S -emit-llvm). There was no references to my string(used in the AnnotateAttrs) or even of something like @llvm.var.annotation. So for some reason they are not making it to the IR and I have no idea why.

Thank you

Hello Mark,

Support for codegen of AnnotateAttr on VarDecls was added in r139423,
which is fairly recent. If you look at the current TOT, you should have
more code that deals with AnnotateAttr.

http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110905/046156.html

Julien