Don't emit explicit specializations of static member variable declarations.

llvm-svn: 90624
This commit is contained in:
Anders Carlsson
2009-12-04 23:50:01 +00:00
parent f85dc3f0f1
commit a30e1750cd
2 changed files with 22 additions and 5 deletions

View File

@@ -576,11 +576,17 @@ void CodeGenModule::EmitGlobal(GlobalDecl GD) {
const VarDecl *VD = cast<VarDecl>(Global);
assert(VD->isFileVarDecl() && "Cannot emit local var decl as global.");
// In C++, if this is marked "extern", defer code generation.
if (getLangOptions().CPlusPlus && !VD->getInit() &&
(VD->getStorageClass() == VarDecl::Extern ||
VD->isExternC()))
return;
if (getLangOptions().CPlusPlus && !VD->getInit()) {
// In C++, if this is marked "extern", defer code generation.
if (VD->getStorageClass() == VarDecl::Extern || VD->isExternC())
return;
// If this is a declaration of an explicit specialization of a static
// data member in a class template, don't emit it.
if (VD->isStaticDataMember() &&
VD->getTemplateSpecializationKind() == TSK_ExplicitSpecialization)
return;
}
// In C, if this isn't a definition, defer code generation.
if (!getLangOptions().CPlusPlus && !VD->getInit())