r283887 - r283882 followup. Don't demote ParmVarDecls. This should fix our module builds.

Vassil Vassilev via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 11 08:09:26 PDT 2016


Author: vvassilev
Date: Tue Oct 11 10:09:26 2016
New Revision: 283887

URL: http://llvm.org/viewvc/llvm-project?rev=283887&view=rev
Log:
r283882 followup. Don't demote ParmVarDecls. This should fix our module builds.

Modified:
    cfe/trunk/lib/Sema/SemaDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=283887&r1=283886&r2=283887&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Oct 11 10:09:26 2016
@@ -9709,20 +9709,22 @@ void Sema::AddInitializerToDecl(Decl *Re
       // 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();
+      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());
+        // 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 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();




More information about the cfe-commits mailing list