diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-22 22:48:32 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-11-22 22:48:32 +0000 |
| commit | 2d988f0f05db22d0771d31e5839ed6df01e8ac19 (patch) | |
| tree | f95ac3e798e7e8ba2529865cc8ba6ceb83b98fb7 /clang/lib/CodeGen/CGExprConstant.cpp | |
| parent | 1959df2c9c2ee2a0b82d08fb6fe0bdfb32d70598 (diff) | |
| download | bcm5719-llvm-2d988f0f05db22d0771d31e5839ed6df01e8ac19.tar.gz bcm5719-llvm-2d988f0f05db22d0771d31e5839ed6df01e8ac19.zip | |
Use static storage duration for file-scope compound literals, even when they
appear in non-constant initializers in C++.
llvm-svn: 145087
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGExprConstant.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp index 7485c71d7db..5d436619d75 100644 --- a/clang/lib/CodeGen/CGExprConstant.cpp +++ b/clang/lib/CodeGen/CGExprConstant.cpp @@ -1087,6 +1087,12 @@ llvm::Constant *CodeGenModule::EmitConstantExpr(const Expr *E, return C; } +llvm::Constant * +CodeGenModule::GetAddrOfConstantCompoundLiteral(const CompoundLiteralExpr *E) { + assert(E->isFileScope() && "not a file-scope compound literal expr"); + return ConstExprEmitter(*this, 0).EmitLValue(E); +} + static uint64_t getFieldOffset(ASTContext &C, const FieldDecl *field) { const ASTRecordLayout &layout = C.getASTRecordLayout(field->getParent()); return layout.getFieldOffset(field->getFieldIndex()); |

