Hi Richard,<br><br>I haven't looked into check it in Sema yet. I had the impression that this type of checks should be performed in parser if possible. Here is what I am thinking.<br><br>There are two cases to deal with here<br>
- attributes appear before decl specifier of function:<br>
[[]] friend into foo();<br> This case can already be detected in parser using ParsedAttributesWithRange.<br><br>- attributes appear after function declarator id<br> friend int foo [[]] ();<br> Attributes in this case are parsed as part of parsing function declarator, so we need some way to pass the parsed attributes to caller where the syntactic checks are handled. I was using AttributeList for this. Without using it, it seems there are two additional options:<br>
Update Declarator so it can return a list of source ranges of C++11 attributes that appertain to the declarator, as the source ranges are what's required to emit the "attributes not allowed here" type of diagnostic. <br>
<br>Or<br><br>Update ParseDeclarator so it takes an additional parameter of ParsedAttributesWithRange. It's probably not worth doing so as ParseDeclarator is invoked in a lot of places and this second parameter will only be useful once.<br>
<br>What do you think? I can look into sema check if that is the right direction to go.<br><br>Cheers<br>Michael<br>
<br><div class="gmail_quote">On Mon, Nov 26, 2012 at 1:56 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Michael,<div><br></div><div>It's not OK to use Sema's AttributeList directly from within lib/Parse. Have you considered performing the check inside Sema instead?<br><br><div class="gmail_quote"><div><div>
On Fri, Nov 23, 2012 at 3:58 PM, Michael Han <span dir="ltr"><<a href="mailto:fragmentshaders@gmail.com" target="_blank">fragmentshaders@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Sorry missing title in last email; resend patch with title this time..<br><br><div class="gmail_quote">
---------- Forwarded message ----------<br>
From: <b class="gmail_sendername">Michael Han</b> <span dir="ltr"><<a href="mailto:fragmentshaders@gmail.com" target="_blank">fragmentshaders@gmail.com</a>></span><br>
Date: Fri, Nov 23, 2012 at 3:53 PM<br>Subject: <br>To: <a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br><br><br>Hi,<br><br>This patch implements C++11 [dcl.attr.grammar] p4: If an attribute-specifier-seq appertains to a friend declaration, that declaration<br>
shall be a definition. Please review.<br><br>Cheers<span><font color="#888888"><span><font color="#888888"><br>Michael<br>
</font></span></font></span></div><br>
<br></div></div>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br>