aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGExprAgg.cpp10
-rw-r--r--lib/CodeGen/CGExprConstant.cpp8
2 files changed, 4 insertions, 14 deletions
diff --git a/lib/CodeGen/CGExprAgg.cpp b/lib/CodeGen/CGExprAgg.cpp
index b6efc1cafa..975f572c0d 100644
--- a/lib/CodeGen/CGExprAgg.cpp
+++ b/lib/CodeGen/CGExprAgg.cpp
@@ -916,14 +916,8 @@ void AggExprEmitter::VisitInitListExpr(InitListExpr *E) {
// Handle initialization of an array.
if (E->getType()->isArrayType()) {
- if (E->getNumInits() > 0) {
- QualType T1 = E->getType();
- QualType T2 = E->getInit(0)->getType();
- if (CGF.getContext().hasSameUnqualifiedType(T1, T2)) {
- EmitAggLoadOfLValue(E->getInit(0));
- return;
- }
- }
+ if (E->isStringLiteralInit())
+ return Visit(E->getInit(0));
QualType elementType =
CGF.getContext().getAsArrayType(E->getType())->getElementType();
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp
index d528e0c4b7..bc9f9ef07b 100644
--- a/lib/CodeGen/CGExprConstant.cpp
+++ b/lib/CodeGen/CGExprConstant.cpp
@@ -758,17 +758,13 @@ public:
}
llvm::Constant *EmitArrayInitialization(InitListExpr *ILE) {
- unsigned NumInitElements = ILE->getNumInits();
- if (NumInitElements == 1 &&
- CGM.getContext().hasSameUnqualifiedType(ILE->getType(),
- ILE->getInit(0)->getType()) &&
- (isa<StringLiteral>(ILE->getInit(0)) ||
- isa<ObjCEncodeExpr>(ILE->getInit(0))))
+ if (ILE->isStringLiteralInit())
return Visit(ILE->getInit(0));
llvm::ArrayType *AType =
cast<llvm::ArrayType>(ConvertType(ILE->getType()));
llvm::Type *ElemTy = AType->getElementType();
+ unsigned NumInitElements = ILE->getNumInits();
unsigned NumElements = AType->getNumElements();
// Initialising an array requires us to automatically