I understand.

What do you think then about adding additional getter in AnnotationAttr that 
will be named getAnnotation (same as before) and that will wrap the 
getAnnotationLiteral()->getString() call? No refactoring would be required in 
remaining parts of the code. The downside is that there will be dependency 
between AST/Attr.h and header with StringLiteral (currently fwd decl is 
sufficient).

Jarek

Od: "Aaron Ballman" <[email protected]>
Do: "Jarosław Rosiek" <[email protected]>; 
Wysłane: 19:47 Poniedziałek 2013-08-19
Temat: Re: [PATCH] Make AnnotateAttr keeps pointer to StringLiteral instead of 
raw string.

> 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,   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" 
> > Do: "Jarosław Rosiek" ;
> > 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
> >> > [email protected]
> >> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> >> >
> >>
> >
> >
> >
> 




_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to