From df88f6fe98793d8305797f23e38d613bc6960028 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. llvm-svn: 152320 --- clang/lib/CodeGen/CodeGenModule.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index b2bfab055b6..0399ec479e7 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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