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
diff --git a/CodeGen/CGExprConstant.cpp b/CodeGen/CGExprConstant.cpp
index cca5982f..2cdd5bb 100644
--- a/CodeGen/CGExprConstant.cpp
+++ b/CodeGen/CGExprConstant.cpp
@@ -69,9 +69,12 @@
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();