make codegen reject initializes with designators, like this:
t.c:1:13: error: cannot codegen this designators yet
int a[10] = {2, 4, [8]=9, 10};
^~~~~~~~~~~~~~~~~
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58220 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 9af269e..2e2eea3 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -154,7 +154,9 @@
Value *VisitShuffleVectorExpr(ShuffleVectorExpr *E);
Value *VisitMemberExpr(Expr *E) { return EmitLoadOfLValue(E); }
Value *VisitExtVectorElementExpr(Expr *E) { return EmitLoadOfLValue(E); }
- Value *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) { return EmitLoadOfLValue(E); }
+ Value *VisitCompoundLiteralExpr(CompoundLiteralExpr *E) {
+ return EmitLoadOfLValue(E);
+ }
Value *VisitStringLiteral(Expr *E) { return EmitLValue(E).getAddress(); }
Value *VisitPredefinedExpr(Expr *E) { return EmitLValue(E).getAddress(); }
@@ -168,6 +170,11 @@
if (!VType)
return Visit(E->getInit(0));
+ if (E->hadDesignators()) {
+ CGF.ErrorUnsupported(E, "initializer list with designators");
+ return llvm::UndefValue::get(CGF.ConvertType(E->getType()));
+ }
+
unsigned NumVectorElements = VType->getNumElements();
const llvm::Type *ElementType = VType->getElementType();