[cfe-commits] [Patch] correct scope token location when parsing GNU attributes
Michael Han
Michael.Han at autodesk.com
Thu Oct 4 09:46:48 PDT 2012
Thank you for the review. Committed as r165234 with both fixes.
Thanks!
Michael
From: metafoo at gmail.com [mailto:metafoo at gmail.com] On Behalf Of Richard Smith
Sent: Wednesday, October 03, 2012 10:51 PM
To: Michael Han
Cc: cfe-commits at cs.uiuc.edu
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 <Michael.Han at autodesk.com<mailto:Michael.Han at autodesk.com>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121004/243f8c86/attachment.html>
More information about the cfe-commits
mailing list