Thank you for the review. Committed as r165234 with both fixes.

Thanks!
Michael

From: [email protected] [mailto:[email protected]] On Behalf Of Richard Smith
Sent: Wednesday, October 03, 2012 10:51 PM
To: Michael Han
Cc: [email protected]
Subject: Re: [Patch] correct scope token location when parsing GNU attributes

> --- lib/Sema/SemaDecl.cpp (revision 165089)
> +++ lib/Sema/SemaDecl.cpp          (working copy)
> @@ -2774,7 +2774,8 @@
>          TypeSpecType == DeclSpec::TST_enum) {
>        AttributeList* attrs = DS.getAttributes().getList();
>        while (attrs) {
> -        Diag(attrs->getScopeLoc(),
> +        Diag(attrs->getScopeLoc().isValid() ?
> +             attrs->getScopeLoc() : attrs->getLoc(),

You can just use attrs->getLoc() here; it points to the first token of the 
attribute. LGTM with that change.

Incidentally, Parser::ParseGNUAttributeArgs's call to addNew isn't passing in 
the right SourceRange any more: the start should be ScopeLoc if it is valid.

On Tue, Oct 2, 2012 at 10:03 PM, Michael Han 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

Attached patch correct the source location of scopes when parsing and creating 
an attribute in GNU syntax: since the GNU syntax attribute does not have scope 
tokens, we shall use a newly created SourceLocation() instead of reuse the 
attribute token source location. As a result, when emitting diagnostics the 
valid of the locations needs to be checked first before used.

Michael

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

Reply via email to