diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-21 20:03:38 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-04-21 20:03:38 +0000 |
commit | 3e8dc2ac8926dfbebd8f2f6b74ceba4befccd4d2 (patch) | |
tree | c08f5ea90e624a522d83e1d952c00f9af0f01993 /lib/Sema/SemaInit.cpp | |
parent | 6f141659cab11109d9931d92d0988f8850778de3 (diff) |
Use the ArrayFiller to fill out "holes" in the array initializer due to designated initializers,
avoiding to create separate Exprs for each one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaInit.cpp')
-rw-r--r-- | lib/Sema/SemaInit.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 307db14b58..2acb482c41 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -404,7 +404,12 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity, if (hadError) { // Do nothing } else if (Init < NumInits) { - ILE->setInit(Init, ElementInit.takeAs<Expr>()); + // For arrays, just set the expression used for value-initialization + // of the "holes" in the array. + if (ElementEntity.getKind() == InitializedEntity::EK_ArrayElement) + ILE->setArrayFiller(ElementInit.takeAs<Expr>()); + else + ILE->setInit(Init, ElementInit.takeAs<Expr>()); } else { // For arrays, just set the expression used for value-initialization // of the rest of elements and exit. |