[cfe-commits] r55940 - in /cfe/trunk: include/clang/AST/Decl.h lib/Sema/SemaDecl.cpp

Daniel Dunbar daniel at zuster.org
Mon Sep 8 13:05:47 PDT 2008


Author: ddunbar
Date: Mon Sep  8 15:05:47 2008
New Revision: 55940

URL: http://llvm.org/viewvc/llvm-project?rev=55940&view=rev
Log:
Add ThreadSpecified bit to Decl.
 - Patch from Kevin Tew.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=55940&r1=55939&r2=55940&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Sep  8 15:05:47 2008
@@ -228,12 +228,14 @@
   Stmt *Init;
   // FIXME: This can be packed into the bitfields in Decl.
   unsigned SClass : 3;
+  bool ThreadSpecified : 1;
   
   friend class StmtIteratorBase;
 protected:
   VarDecl(Kind DK, DeclContext *DC, SourceLocation L, IdentifierInfo *Id,
           QualType T, StorageClass SC, ScopedDecl *PrevDecl)
-    : ValueDecl(DK, DC, L, Id, T, PrevDecl), Init(0) { SClass = SC; }
+    : ValueDecl(DK, DC, L, Id, T, PrevDecl), Init(0),
+          ThreadSpecified(false) { SClass = SC; }
 public:
   static VarDecl *Create(ASTContext &C, DeclContext *DC,
                          SourceLocation L, IdentifierInfo *Id,
@@ -245,6 +247,11 @@
   Expr *getInit() { return (Expr*) Init; }
   void setInit(Expr *I) { Init = (Stmt*) I; }
       
+  void setThreadSpecified(bool T) { ThreadSpecified = T; }
+  bool isThreadSpecified() const {
+    return ThreadSpecified;
+  }
+  
   /// hasLocalStorage - Returns true if a variable with function scope
   ///  is a non-static local variable.
   bool hasLocalStorage() const {

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=55940&r1=55939&r2=55940&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Mon Sep  8 15:05:47 2008
@@ -743,6 +743,7 @@
                                       D.getIdentifierLoc(), II,
                                       R, LastDeclarator);
     } else {
+      bool ThreadSpecified = D.getDeclSpec().isThreadSpecified();
       if (S->getFnParent() == 0) {
         // C99 6.9p2: The storage-class specifiers auto and register shall not
         // appear in the declaration specifiers in an external declaration.
@@ -751,12 +752,10 @@
                R.getAsString());
           InvalidDecl = true;
         }
-        NewVD = VarDecl::Create(Context, CurContext, D.getIdentifierLoc(),
-                                II, R, SC, LastDeclarator);
-      } else {
-        NewVD = VarDecl::Create(Context, CurContext, D.getIdentifierLoc(),
-                                II, R, SC, LastDeclarator);
       }
+        NewVD = VarDecl::Create(Context, CurContext, D.getIdentifierLoc(), 
+                                II, R, SC, LastDeclarator);
+        NewVD->setThreadSpecified(ThreadSpecified);
     }
     // Handle attributes prior to checking for duplicates in MergeVarDecl
     ProcessDeclAttributes(NewVD, D);





More information about the cfe-commits mailing list