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
This commit is contained in:
Eli Friedman 2008-02-21 17:45:41 +00:00
Родитель 3513e138cc
Коммит 4d1c018607
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -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();