[cfe-dev] manipulating @llvm.var.annotation in AST?

Mark Brown mbrowncu98 at gmail.com
Tue Sep 13 16:20:20 PDT 2011


My plugin now adds AnnotateAttr objects directly to VarDecls, and writes out
the AST file. This AST file is compiled to clang, with the -S -emit-llvm
options, and there is nothing about these AnnotateAttr in there. I can tell
they are being add because they print to the screen before hand, but there
are no traces in the IR file.

I was expecting to see my string or atleast a reference to
@llvm.var.annotation.

Am I missing something?

Thank you

On Thu, Sep 8, 2011 at 3:15 PM, John McCall <rjmccall at apple.com> wrote:

> On Sep 8, 2011, at 12:07 PM, Mark Brown wrote:
> > Now that they are added, how is this saved for later use?
> >
> > The PrintFunctionNames example is ran by
> >      clang -cc1 -load ~/llvm/Release+Asserts/lib/libPrintFunctionNames.so
> -plugin print-fns input_file.c
> >
> > But how does this get stored/saved for the Pass phase? How do the new
> contents of llvm.var.annotation get stored/saved? "-emit-llvm -S" does not
> seem to help
>
> Probably IR generation is running before you make your changes to the AST.
>  I don't know the plugin system well enough to know if/how this is fixable.
>
> John.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110913/7144b47a/attachment.html>


More information about the cfe-dev mailing list