summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2008-08-22 16:00:37 +0000
committerAnders Carlsson <andersca@mac.com>2008-08-22 16:00:37 +0000
commit87fc5a5e6b9c021dc8e6aaa6c80d218ac4ea1970 (patch)
tree91576504f731478d53f771e4c29de6ff6daeb983 /clang/lib/CodeGen/CGDecl.cpp
parentd564f2995706d4268eeffc16bbaded0bdd3bae8f (diff)
downloadbcm5719-llvm-87fc5a5e6b9c021dc8e6aaa6c80d218ac4ea1970.tar.gz
bcm5719-llvm-87fc5a5e6b9c021dc8e6aaa6c80d218ac4ea1970.zip
Add preliminary (and probably broken) codegen support for C++ static initializers.
llvm-svn: 55180
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 1d1721011b0..b60e20fda5a 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -86,7 +86,13 @@ CodeGenFunction::GenerateStaticBlockVarDecl(const VarDecl &D,
if ((D.getInit() == 0) || NoInit) {
Init = llvm::Constant::getNullValue(LTy);
} else {
- Init = CGM.EmitConstantExpr(D.getInit(), this);
+ if (D.getInit()->isConstantExpr(getContext(), 0))
+ Init = CGM.EmitConstantExpr(D.getInit(), this);
+ else {
+ assert(getContext().getLangOptions().CPlusPlus &&
+ "only C++ supports non-constant static initializers!");
+ return GenerateStaticCXXBlockVarDecl(D);
+ }
}
assert(Init && "Unable to create initialiser for static decl");
OpenPOWER on IntegriCloud