aboutsummaryrefslogtreecommitdiff
path: root/CodeGen
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-02-21 17:45:41 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-02-21 17:45:41 +0000
commit4d1c01860708c05757f6a0e17fd90e584000c752 (patch)
tree204c56c4ee54f421c625fe88069fbd80aa13aea3 /CodeGen
parent3513e138cc75205b48d3078dfa4669355adb5714 (diff)
Fix brace-enclosed string initializers for char arrays. From pr2079,
ahtough I had the fix in my tree previously. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47439 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen')
-rw-r--r--CodeGen/CGExprConstant.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/CodeGen/CGExprConstant.cpp b/CodeGen/CGExprConstant.cpp
index cca5982f6d..2cdd5bbb3e 100644
--- a/CodeGen/CGExprConstant.cpp
+++ b/CodeGen/CGExprConstant.cpp
@@ -69,9 +69,12 @@ public:
llvm::Constant *EmitArrayInitialization(InitListExpr *ILE,
const llvm::ArrayType *AType) {
-
- std::vector<llvm::Constant*> Elts;
- unsigned NumInitElements = ILE->getNumInits();
+ std::vector<llvm::Constant*> Elts;
+ unsigned NumInitElements = ILE->getNumInits();
+ // FIXME: Check for wide strings
+ if (NumInitElements > 0 && isa<StringLiteral>(ILE->getInit(0)) &&
+ ILE->getType()->getAsArrayType()->getElementType()->isCharType())
+ return Visit(ILE->getInit(0));
const llvm::Type *ElemTy = AType->getElementType();
unsigned NumElements = AType->getNumElements();