On Wed, Feb 20, 2013 at 4:16 PM, Michael Han <span dir="ltr"><<a href="mailto:fragmentshaders@gmail.com" target="_blank">fragmentshaders@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Richard,<br><br>For attribute declarations, are they appertaining to the translation unit in which they are declared? If true then maybe TranslationUnitDecl is a place to store the AST nodes for these attributes? If not what would be the right place to store these attributes in AST? I am interested to work on this as I need declare attributes at TU scope then retrieve them later from AST. </blockquote>
<div><br></div><div>Attribute declarations don't really appertain to anything (except maybe the attribute-declaration itself). I think a reasonable representation would be to introduce an EmptyDecl, for both attribute-declarations and empty-declarations, and apply the attributes in an attribute-declaration to that.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>Michael.<br><br></font></span><div class="gmail_quote"><div class="im">
On Wed, Feb 20, 2013 at 11:22 AM, Richard Smith <span dir="ltr"><<a href="mailto:richard-llvm@metafoo.co.uk" target="_blank">richard-llvm@metafoo.co.uk</a>></span> wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">Author: rsmith<br>
Date: Wed Feb 20 13:22:51 2013<br>
New Revision: 175649<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=175649&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=175649&view=rev</a><br>
Log:<br>
Process and handle attributes on conditions and for loop variables. Process and<br>
diagnose attributes on alias declarations, using directives, and attribute<br>
declarations.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
    cfe/trunk/include/clang/Parse/Parser.h<br>
    cfe/trunk/include/clang/Sema/Sema.h<br>
    cfe/trunk/lib/Parse/ParseDecl.cpp<br>
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
    cfe/trunk/lib/Parse/ParseExprCXX.cpp<br>
    cfe/trunk/lib/Parse/ParseStmt.cpp<br>
    cfe/trunk/lib/Parse/Parser.cpp<br>
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
    cfe/trunk/lib/Sema/SemaType.cpp<br>
    cfe/trunk/test/Parser/cxx0x-attributes.cpp<br>
<br>
<br></div><div><div class="h5">
==============================================================================<br>
--- cfe/trunk/lib/Parse/Parser.cpp (original)<br>
+++ cfe/trunk/lib/Parse/Parser.cpp Wed Feb 20 13:22:51 2013<br>
@@ -566,7 +566,6 @@ bool Parser::ParseTopLevelDecl(DeclGroup<br>
 ///       external-declaration: [C99 6.9], declaration: [C++ dcl.dcl]<br>
 ///         function-definition<br>
 ///         declaration<br>
-/// [C++0x] empty-declaration<br>
 /// [GNU]   asm-definition<br>
 /// [GNU]   __extension__ external-declaration<br>
 /// [OBJC]  objc-class-definition<br>
@@ -578,8 +577,10 @@ bool Parser::ParseTopLevelDecl(DeclGroup<br>
 /// [C++]   linkage-specification<br>
 /// [GNU] asm-definition:<br>
 ///         simple-asm-expr ';'<br>
+/// [C++11] empty-declaration<br>
+/// [C++11] attribute-declaration<br>
 ///<br>
-/// [C++0x] empty-declaration:<br>
+/// [C++11] empty-declaration:<br>
 ///           ';'<br>
 ///<br>
 /// [C++0x/GNU] 'extern' 'template' declaration<br>
@@ -624,6 +625,13 @@ Parser::ParseExternalDeclaration(ParsedA<br>
     HandlePragmaOpenCLExtension();<br>
     return DeclGroupPtrTy();<br>
   case tok::semi:<br>
+    // Either a C++11 empty-declaration or attribute-declaration.<br>
+    if (attrs.Range.isValid()) {<br>
+      // FIXME: Add an AST representation for this.<br>
+      Actions.ActOnAttributeDeclaration(attrs.getList());<br>
+      return DeclGroupPtrTy();<br>
+    }<br>
+<br>
     ConsumeExtraSemi(OutsideFunction);<br>
     // TODO: Invoke action for top-level semicolon.<br>
     return DeclGroupPtrTy();<br>
<br></div></div></blockquote></div>
</blockquote></div><br>