[PATCH] Make AnnotateAttr keeps pointer to StringLiteral instead of raw string.

jaroslaw.rosiek at interia.pl jaroslaw.rosiek at interia.pl
Mon Aug 19 07:35:44 PDT 2013


Hi,

Let me explain what I needed it for. I was working on a tool that uses annotations as a source of "configuration" that can tweak the process of AST analysis/usage. Since the configuration can be complex I need to parse the annotation string to extract necessary information. I wanted to reuse CLang's infrastructure for diagnostics (maybe lexing too) to provide user friendly output. Right now (with const char* + length) the best thhing I could do is to setup completely independent DiagnosticsEngine/Lexer/Preprocessor etc. There is no connection with existing source code to have useful diagnostics with line numbers etc. On the other hand if I have StringLeteral I can extract necessary information about location of the string.

I'm new to clang, so maybe there is simpler solution that I don't see yet. I will appreciate any suggestions.

Thanks,
Jarek

Od: "Aaron Ballman" <aaron at aaronballman.com>
Do: "Jarosław Rosiek" <jaroslaw.rosiek at interia.pl>; 
Wysłane: 15:45 Poniedziałek 2013-08-19
Temat: Re: [PATCH] Make AnnotateAttr keeps pointer to StringLiteral instead of raw string.

> This doesn't appear to make anything easier or more clean, so perhaps
> I'm misunderstanding the purpose.  Can you give some more concrete
> examples of the benefits of this approach over the current one?
> 
> Thanks!
> 
> ~Aaron
> 
> On Sun, Aug 18, 2013 at 6:10 PM, Jarosław Rosiek
>  wrote:
> > Hi,
> >
> > This is my first patch here, so please be gentle :)
> >
> > This change enables usage of standard lexing/parsing/diagnosics
> > infrastructure during processing of annotation string. This may be useful
> > when someone implements a tool that processes metadata provided in
> > annotations and this metadata requires further parsing (in a manner similar
> > to current treatment of _Pragma directive).
> >
> > Thanks,
> > Jarek
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >
> 







More information about the cfe-commits mailing list