If a declarator group declares a type, make sure to add that declaration 
to the DeclGroup.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72559 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Parse/Action.h b/include/clang/Parse/Action.h
index 86e3194..328de90 100644
--- a/include/clang/Parse/Action.h
+++ b/include/clang/Parse/Action.h
@@ -291,7 +291,8 @@
 
   /// 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();
   }
diff --git a/lib/Frontend/PrintParserCallbacks.cpp b/lib/Frontend/PrintParserCallbacks.cpp
index 73530ef..ca13f3d 100644
--- a/lib/Frontend/PrintParserCallbacks.cpp
+++ b/lib/Frontend/PrintParserCallbacks.cpp
@@ -116,7 +116,8 @@
     /// 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();
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 54e70be..b667014 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -437,7 +437,8 @@
     ParseDeclarator(D);
   }
   
-  return Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
+  return Actions.FinalizeDeclaratorGroup(CurScope, D.getDeclSpec(),
+                                         DeclsInGroup.data(),
                                          DeclsInGroup.size());
 }
 
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index cfbd909..7cbd72b 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -970,7 +970,7 @@
 
   if (Tok.is(tok::semi)) {
     ConsumeToken();
-    Actions.FinalizeDeclaratorGroup(CurScope, DeclsInGroup.data(),
+    Actions.FinalizeDeclaratorGroup(CurScope, DS, DeclsInGroup.data(),
                                     DeclsInGroup.size());
     return;
   }
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index fae5a92..75632d5 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -410,7 +410,8 @@
   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);
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 6a2e309..8bd753a 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2754,10 +2754,14 @@
   }
 }
 
-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);