[cfe-dev] Is there anyway I can add some custom information to the AST?

Aaron Ballman via cfe-dev cfe-dev at lists.llvm.org
Sat Jul 4 11:53:12 PDT 2020


On Sat, Jul 4, 2020 at 12:06 PM Yafei Liu via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
>
> Hi, all.
> I'm writing some tools to convert a C++ class to something else, and I want to add  some custom information to the AST.
>
> At first, I decided to add some comments to mark some classes, but I found that the AST does not contain comments.
>
> Secondly, I want to customize an attribute, but I found that it needs to recompile the Clang, I didn't find a "plug-in" way.  Since my tools are designed for public usage, a customized compiler is not very considerable.

You might be able to use the annotate attribute, as that's one of the
purposes it serves: https://godbolt.org/z/_Ggr6e

~Aaron


More information about the cfe-dev mailing list