]> granicus.if.org Git - clang/commitdiff
r283882 followup. Don't demote ParmVarDecls. This should fix our module builds.
authorVassil Vassilev <v.g.vassilev@gmail.com>
Tue, 11 Oct 2016 15:09:26 +0000 (15:09 +0000)
committerVassil Vassilev <v.g.vassilev@gmail.com>
Tue, 11 Oct 2016 15:09:26 +0000 (15:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283887 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp

index c9a45b2ecc5c1117da45632f6a82fc46bcc40820..cf6f0c818b05c6ad5c22a999403766c879616983 100644 (file)
@@ -9709,20 +9709,22 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
       // The previous definition is hidden, and multiple definitions are
       // permitted (in separate TUs). Form another definition of it.
 
-      // Demote the newly parsed definition to a fake declaration.
-      if (!VDecl->isThisDeclarationADemotedDefinition())
-        VDecl->demoteThisDefinitionToDeclaration();
-
-      // Make the definition visible from the point of the demotion on.
-      assert (!Hidden || Def == Hidden &&
-              "We were suggested another hidden definition!");
-      makeMergedDefinitionVisible(Def, VDecl->getLocation());
-
-      // If this is a variable template definition, make its enclosing template
-      // visible.
-      if (VarDecl *VarPattern = Def->getTemplateInstantiationPattern())
-        if (VarPattern->isThisDeclarationADefinition())
-          makeMergedDefinitionVisible(VarPattern, VDecl->getLocation());
+      if (!isa<ParmVarDecl>(VDecl)) {
+        // Demote the newly parsed definition to a fake declaration.
+        if (!VDecl->isThisDeclarationADemotedDefinition())
+          VDecl->demoteThisDefinitionToDeclaration();
+
+        // Make the definition visible from the point of the demotion on.
+        assert (!Hidden || Def == Hidden &&
+                "We were suggested another hidden definition!");
+        makeMergedDefinitionVisible(Def, VDecl->getLocation());
+
+        // If this is a variable template definition, make its enclosing template
+        // visible.
+        if (VarDecl *VarPattern = Def->getTemplateInstantiationPattern())
+          if (VarPattern->isThisDeclarationADefinition())
+            makeMergedDefinitionVisible(VarPattern, VDecl->getLocation());
+      }
     } else {
       Diag(VDecl->getLocation(), diag::err_redefinition)
         << VDecl->getDeclName();