diff options
author | Anders Carlsson <andersca@mac.com> | 2008-08-22 16:00:37 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2008-08-22 16:00:37 +0000 |
commit | e1b29efab32d02e114046d33cca242a88585bf8a (patch) | |
tree | 0ab7ea8db462d66fc55021db01cea62bd2bb5cbf /lib/CodeGen/CGDecl.cpp | |
parent | 4bd8217d94d42e0f1439defe2001292988dc5288 (diff) |
Add preliminary (and probably broken) codegen support for C++ static initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | lib/CodeGen/CGDecl.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp index 1d1721011b..b60e20fda5 100644 --- a/lib/CodeGen/CGDecl.cpp +++ b/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"); |