[cfe-commits] r47439 - /cfe/trunk/CodeGen/CGExprConstant.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Feb 21 09:45:41 PST 2008
Author: efriedma
Date: Thu Feb 21 11:45:41 2008
New Revision: 47439
URL: http://llvm.org/viewvc/llvm-project?rev=47439&view=rev
Log:
Fix brace-enclosed string initializers for char arrays. From pr2079,
ahtough I had the fix in my tree previously.
Modified:
cfe/trunk/CodeGen/CGExprConstant.cpp
Modified: cfe/trunk/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGExprConstant.cpp?rev=47439&r1=47438&r2=47439&view=diff
==============================================================================
--- cfe/trunk/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/CodeGen/CGExprConstant.cpp Thu Feb 21 11:45:41 2008
@@ -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();
More information about the cfe-commits
mailing list