]> granicus.if.org Git - clang/commitdiff
If a declarator group declares a type, make sure to add that declaration
authorEli Friedman <eli.friedman@gmail.com>
Fri, 29 May 2009 01:49:24 +0000 (01:49 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 29 May 2009 01:49:24 +0000 (01:49 +0000)
to the DeclGroup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72559 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Action.h
lib/Frontend/PrintParserCallbacks.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Sema/Sema.h
lib/Sema/SemaDecl.cpp

index 86e319483640cbb83dfd2280a52866034eb23cc9..328de90036bc8bf83739c756e35ddd5eb0a08615 100644 (file)
@@ -291,7 +291,8 @@ public:
 
   /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed, this
   /// gives the actions implementation a chance to process the group as a whole.
-  virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group,
+  virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
+                                                 DeclPtrTy *Group,
                                                  unsigned NumDecls) {
     return DeclGroupPtrTy();
   }
index 73530ef58d86c487c558d2f8339078c29765be7a..ca13f3df29877398e4fc9370bb9043e0ea78c99f 100644 (file)
@@ -116,7 +116,8 @@ namespace {
     /// FinalizeDeclaratorGroup - After a sequence of declarators are parsed,
     /// this gives the actions implementation a chance to process the group as
     /// a whole.
-    virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group,
+    virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec& DS,
+                                                   DeclPtrTy *Group,
                                                    unsigned NumDecls) {
       Out << __FUNCTION__ << "\n";
       return DeclGroupPtrTy();
index 54e70be16ec6353775040d2d69dfab1fc066369c..b667014efc70cb15e3e335b1b8ed1fc4c49a9ce4 100644 (file)
@@ -437,7 +437,8 @@ ParseInitDeclaratorListAfterFirstDeclarator(Declarator &D) {
     ParseDeclarator(D);
   }
   
-  return Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
+  return Actions.FinalizeDeclaratorGroup(CurScope, D.getDeclSpec(),
+                                         DeclsInGroup.data(),
                                          DeclsInGroup.size());
 }
 
index cfbd9097f72f7b8bc4cb03411cd6a35329d929da..7cbd72bed4ee12a2470e40de033e6bfd9dad6f08 100644 (file)
@@ -970,7 +970,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS) {
 
   if (Tok.is(tok::semi)) {
     ConsumeToken();
-    Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
+    Actions.FinalizeDeclaratorGroup(CurScope, DS, DeclsInGroup.data(),
                                     DeclsInGroup.size());
     return;
   }
index fae5a927478ba5b78d645010b9846d208024c89a..75632d560ec802a02eaec91dcfa85a2220511364 100644 (file)
@@ -410,7 +410,8 @@ public:
   void AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit);
   void ActOnUninitializedDecl(DeclPtrTy dcl);
   virtual void SetDeclDeleted(DeclPtrTy dcl, SourceLocation DelLoc);
-  virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group,
+  virtual DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
+                                                 DeclPtrTy *Group,
                                                  unsigned NumDecls);
   virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D,
                                                SourceLocation LocAfterDecls);
index 6a2e3099cd2bbe257d6b668651b0e3f4a981f242..8bd753abeaed5ceeaab907fa1b3f5dace7e1b9ed 100644 (file)
@@ -2754,10 +2754,14 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl) {
   }
 }
 
-Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, DeclPtrTy *Group,
+Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
+                                                   DeclPtrTy *Group,
                                                    unsigned NumDecls) {
   llvm::SmallVector<Decl*, 8> Decls;
-  
+
+  if (DS.isTypeSpecOwned())
+    Decls.push_back((Decl*)DS.getTypeRep());
+
   for (unsigned i = 0; i != NumDecls; ++i)
     if (Decl *D = Group[i].getAs<Decl>())
       Decls.push_back(D);