summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-01-26 04:02:23 +0000
committerAnders Carlsson <andersca@mac.com>2010-01-26 04:02:23 +0000
commit20bbbd489bf1b66e079f39708406148bcbb65b06 (patch)
tree8c6ab473066e1a0cfb818518ae1eee6e52a5092c /clang/lib/CodeGen/CGDecl.cpp
parent19afd61201b121ee878a2eac6e03a8887cf68b1b (diff)
downloadbcm5719-llvm-20bbbd489bf1b66e079f39708406148bcbb65b06.tar.gz
bcm5719-llvm-20bbbd489bf1b66e079f39708406148bcbb65b06.zip
Make sure to always mark a global variable as not being constant if it has a C++ initializer.
llvm-svn: 94504
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 9606a71527a..23b4ff26a2e 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -138,8 +138,13 @@ CodeGenFunction::AddInitializerToGlobalBlockVarDecl(const VarDecl &D,
if (!Init) {
if (!getContext().getLangOptions().CPlusPlus)
CGM.ErrorUnsupported(D.getInit(), "constant l-value expression");
- else
+ else {
+ // Since we have a static initializer, this global variable can't
+ // be constant.
+ GV->setConstant(false);
+
EmitStaticCXXBlockVarDeclInit(D, GV);
+ }
return GV;
}
OpenPOWER on IntegriCloud