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

Aaron Ballman aaron at aaronballman.com
Mon Aug 19 10:36:20 PDT 2013


Thank you for the explanation, that makes more sense to me.

I guess my concerns boil down to the fact that the patch adds
complexity to the code (since you have to get the string back out from
the literal in basically every situation), only apply to annotation
attributes and have limited benefits outside of your tool.  So I see
why it's beneficial in your case, but it'd be best if we could find a
way for it to reduce complexity or add utility outside of your tool as
well.

~Aaron

On Mon, Aug 19, 2013 at 10:35 AM,  <jaroslaw.rosiek at interia.pl> wrote:
> 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