<div>> --- lib/Sema/SemaDecl.cpp<span class="Apple-tab-span" style="white-space:pre">        </span>(revision 165089)</div><div>> +++ lib/Sema/SemaDecl.cpp<span class="Apple-tab-span" style="white-space:pre">      </span>(working copy)</div>
<div>> @@ -2774,7 +2774,8 @@</div><div>>          TypeSpecType == DeclSpec::TST_enum) {</div><div>>        AttributeList* attrs = DS.getAttributes().getList();</div><div>>        while (attrs) {</div><div>> -        Diag(attrs->getScopeLoc(),</div>
<div>> +        Diag(attrs->getScopeLoc().isValid() ? </div><div>> +             attrs->getScopeLoc() : attrs->getLoc(),</div><div><br></div><div>You can just use attrs->getLoc() here; it points to the first token of the attribute. LGTM with that change.</div>
<div><br></div><div>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.</div><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 10:03 PM, Michael Han <span dir="ltr"><<a href="mailto:Michael.Han@autodesk.com" target="_blank">Michael.Han@autodesk.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
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.<br>

<span class="HOEnZb"><font color="#888888"><br>
Michael<br>
</font></span></blockquote></div><br>