[cfe-dev] LibTooling for parsing C++ that uses unknown attributes
Benjamin Kramer via cfe-dev
cfe-dev at lists.llvm.org
Thu Jan 7 02:22:32 PST 2016
+aaron
I don't think we currently have a way to expose custom attributes in
the AST without patching Attr.td. Some workarounds exists, like using
a comment as your attribute and checking for its (textual) presence.
Another option is the generic "annotate" attribute, which is intended
to be a attribute for random strings to be consumed by a tool or LLVM
IR pass.
- Ben
On Tue, Jan 5, 2016 at 9:26 PM, Robert W. Johnstone via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> Hello,
>
> I'm starting an experimental project to generate code to marshal and
> unmarshal C++ data. The goal would be a tool that would parse the header
> files, and then write the necessary methods. I started an implementation
> using LibTooling, but found that the custom attributes would not available.
> Going back to the documentation, this appears to be the correct behaviour.
>
> Before I decide that I need a fork of libclang, is there a way to add
> attributes to the compiler when using LibTooling, or to request that unknown
> attributes are kept and present in the AST?
>
> Thank-you,
>
> Robert
>
>
> --
> ----------------------------------------
> Robert W. Johnstone
> In theory, there is no difference between theory and practice.
> In practice, there is.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list