diff options
author | Anders Carlsson <andersca@mac.com> | 2009-12-04 23:50:01 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-12-04 23:50:01 +0000 |
commit | 1b3171dd6c7c319655f79de80ed8fed03f758e51 (patch) | |
tree | 92d63d56986f0232ce45c57f474df3e5c2f0caff /lib/CodeGen/CodeGenModule.cpp | |
parent | 6a1e0eb557d47e85185e09bdf8721f53f4bf9c9c (diff) |
Don't emit explicit specializations of static member variable declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90624 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 4b3b122b71..5656b4657a 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -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()) |