aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-01-26 06:15:16 +0000
committerAnders Carlsson <andersca@mac.com>2010-01-26 06:15:16 +0000
commitd0c4792ca6bde9d60002760c10eb605ed2eebde8 (patch)
tree1e896feec2e90d5d031dd1c5e050b5bd1e9fd0b2 /lib/CodeGen
parenta113e7263c5337731c65fada9de7ff72af25423b (diff)
If a global variable has an initializer with side effects, it can never be deferred (even if it's in an anonymous namespace).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94525 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index cf504a7c2a..65b29313c6 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -580,9 +580,8 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
// Static data may be deferred, but out-of-line static data members
// cannot be.
- if (VD->isInAnonymousNamespace())
- return true;
- if (VD->getLinkage() == VarDecl::InternalLinkage) {
+ if (VD->getLinkage() == VarDecl::InternalLinkage ||
+ VD->isInAnonymousNamespace()) {
// Initializer has side effects?
if (VD->getInit() && VD->getInit()->HasSideEffects(Context))
return false;