summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-12-04 23:50:01 +0000
committerAnders Carlsson <andersca@mac.com>2009-12-04 23:50:01 +0000
commita30e1750cdfc51ed0a60c4960884d70ae3ca3a35 (patch)
tree41037e74ae897619739ffee6e60fd89eee21ea25 /clang/lib/CodeGen/CodeGenModule.cpp
parentf85dc3f0f1c9bbc467ef822616734e9e0e4c6bbd (diff)
downloadbcm5719-llvm-a30e1750cdfc51ed0a60c4960884d70ae3ca3a35.tar.gz
bcm5719-llvm-a30e1750cdfc51ed0a60c4960884d70ae3ca3a35.zip
Don't emit explicit specializations of static member variable declarations.
llvm-svn: 90624
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 4b3b122b71c..5656b4657a4 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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())
OpenPOWER on IntegriCloud