summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-26 23:43:26 +0000
committerChris Lattner <sabre@nondot.org>2008-10-26 23:43:26 +0000
commit07d754acf11590af580bcc4b8816105a60ebb8fe (patch)
tree826faaa9f03a4d583f6fc74cf49b69879832d94a /clang/lib
parent248388e3131be2fda43387653ced370b6aaf95b2 (diff)
downloadbcm5719-llvm-07d754acf11590af580bcc4b8816105a60ebb8fe.tar.gz
bcm5719-llvm-07d754acf11590af580bcc4b8816105a60ebb8fe.zip
Remember whether an initlist had a designator in the AST.
llvm-svn: 58218
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Expr.cpp11
-rw-r--r--clang/lib/Sema/SemaExpr.cpp4
-rw-r--r--clang/lib/Sema/SemaInit.cpp3
3 files changed, 10 insertions, 8 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index c20ca25f283..f18586fb709 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -204,13 +204,12 @@ const char *BinaryOperator::getOpcodeStr(Opcode Op) {
}
InitListExpr::InitListExpr(SourceLocation lbraceloc,
- Expr **initexprs, unsigned numinits,
- SourceLocation rbraceloc)
+ Expr **initExprs, unsigned numInits,
+ SourceLocation rbraceloc, bool hadDesignators)
: Expr(InitListExprClass, QualType()),
- LBraceLoc(lbraceloc), RBraceLoc(rbraceloc)
-{
- for (unsigned i = 0; i != numinits; i++)
- InitExprs.push_back(initexprs[i]);
+ LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), HadDesignators(hadDesignators) {
+
+ InitExprs.insert(InitExprs.end(), initExprs, initExprs+numInits);
}
/// getFunctionType - Return the underlying function type for this block.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index fee94568b78..5304fd9f7a5 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -22,6 +22,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Parse/DeclSpec.h"
+#include "clang/Parse/Designator.h"
#include "clang/Parse/Scope.h"
using namespace clang;
@@ -1260,7 +1261,8 @@ ActOnInitList(SourceLocation LBraceLoc, ExprTy **initlist, unsigned NumInit,
// Semantic analysis for initializers is done by ActOnDeclarator() and
// CheckInitializer() - it requires knowledge of the object being intialized.
- InitListExpr *E = new InitListExpr(LBraceLoc, InitList, NumInit, RBraceLoc);
+ InitListExpr *E = new InitListExpr(LBraceLoc, InitList, NumInit, RBraceLoc,
+ Designators.hasAnyDesignators());
E->setType(Context.VoidTy); // FIXME: just a place holder for now.
return E;
}
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index 12ca3820dd4..0e627a1aab4 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -87,7 +87,8 @@ void InitListChecker::CheckImplicitInitList(InitListExpr *ParentIList,
// Synthesize an "implicit" InitListExpr (marked by the invalid source locs).
InitListExpr *ILE = new InitListExpr(SourceLocation(),
&InitExprs[0], InitExprs.size(),
- SourceLocation());
+ SourceLocation(),
+ ParentIList->hadDesignators());
ILE->setType(T);
// Modify the parent InitListExpr to point to the implicit InitListExpr.
OpenPOWER on IntegriCloud