From: Vassil Vassilev Date: Tue, 11 Oct 2016 15:09:26 +0000 (+0000) Subject: r283882 followup. Don't demote ParmVarDecls. This should fix our module builds. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4e0d7fffab0692584b1a66f913e79273e8590d1;p=clang r283882 followup. Don't demote ParmVarDecls. This should fix our module builds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@283887 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index c9a45b2ecc..cf6f0c818b 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -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(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();