LibTooling: Source Annotations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

LibTooling: Source Annotations

Louis Dionne via cfe-dev
Hello all,

we are encountering a very similar problem to what has been described in
this posting:

What we need is a "comment AST Node" at the correct location in the AST
which can hold information (i.e., a string). For example this code:

#pragma comment (user, "Begin Section1")
#pragma comment (user, "End Section1")

should translate to this AST subtree:

- CallExpr(foo)
- PragmaCommentDecl("Begin Section1")
- CallExpr(bar)
- PragmaCommentDecl("End Section1")

However, as described in the posting linked above, the PragmaCommentDecl
is always a direct child of the TranslationUnitDecl, meaning that its
location in the AST does not reflect its location in the source code.
The main concern with javadoc style C comments is, that they are only
generated in the AST when they are attached to declarations. Therefore,
none of the two are really suitable for the task at hand.

Are there any other ways, we did not discover yet? If you encountered
this problem as well: how did you solve it? Thanks in advance.

Best Regards


cfe-dev mailing list
[hidden email]