From 7401cf524cdb7aad4951d8727d280f8b271af5a2 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 22 Nov 2011 22:48:32 +0000 Subject: Use static storage duration for file-scope compound literals, even when they appear in non-constant initializers in C++. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145087 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExprConstant.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/CodeGen/CGExprConstant.cpp') diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index 7485c71d7d..5d436619d7 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/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()); -- cgit v1.2.3