From 025039377d7247620750205dbd61ca1ba336f7e0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Thu, 8 Mar 2012 15:51:03 +0000 Subject: Replace MarkVarRequired with a more generic HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152320 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index b2bfab055b..0399ec479e 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1722,8 +1722,12 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old, } } -void CodeGenModule::MarkVarRequired(VarDecl *VD) { - GetAddrOfGlobalVar(VD); +void CodeGenModule::HandleCXXStaticMemberVarInstantiation(VarDecl *VD) { + TemplateSpecializationKind TSK = VD->getTemplateSpecializationKind(); + // If we have a definition, this might be a deferred decl. If the + // instantiation is explicit, make sure we emit it at the end. + if (VD->getDefinition() && TSK == TSK_ExplicitInstantiationDefinition) + GetAddrOfGlobalVar(VD); } void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { -- cgit v1.2.3-70-g09d2