summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-28 21:54:33 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-28 21:54:33 +0000
commit347f7eabb9ae43482f04855cde43f9d164b7b6f0 (patch)
treeb167e4bf7fc08a2d9c09efd46cb7775daed2b521 /clang/lib/Sema/SemaExpr.cpp
parentc78320960513fe9f193104cbb07b0a5711c81ee0 (diff)
downloadbcm5719-llvm-347f7eabb9ae43482f04855cde43f9d164b7b6f0.tar.gz
bcm5719-llvm-347f7eabb9ae43482f04855cde43f9d164b7b6f0.zip
Code generation support for C99 designated initializers.
The approach I've taken in this patch is relatively straightforward, although the code itself is non-trivial. Essentially, as we process an initializer list we build up a fully-explicit representation of the initializer list, where each of the subobject initializations occurs in order. Designators serve to "fill in" subobject initializations in a non-linear way. The fully-explicit representation makes initializer lists (both with and without designators) easy to grok for codegen and later semantic analyses. We keep the syntactic form of the initializer list linked into the AST for those clients interested in exactly what the user wrote. Known limitations: - Designating a member of a union that isn't the first member may result in bogus initialization (we warn about this) - GNU array-range designators are not supported (we warn about this) llvm-svn: 63242
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 770404d82ac..064b8517f7c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1985,7 +1985,7 @@ Sema::ActOnInitList(SourceLocation LBraceLoc, MultiExprArg initlist,
// CheckInitializer() - it requires knowledge of the object being intialized.
InitListExpr *E = new (Context) InitListExpr(LBraceLoc, InitList, NumInit,
- RBraceLoc, Designators.hasAnyDesignators());
+ RBraceLoc);
E->setType(Context.VoidTy); // FIXME: just a place holder for now.
return Owned(E);
}
@@ -3988,8 +3988,7 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
// Otherwise, create a compound literal expression as the base, and
// iteratively process the offsetof designators.
InitListExpr *IList =
- new (Context) InitListExpr(SourceLocation(), 0, 0,
- SourceLocation(), false);
+ new (Context) InitListExpr(SourceLocation(), 0, 0, SourceLocation());
IList->setType(ArgTy);
Expr *Res =
new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, IList, false);
OpenPOWER on IntegriCloud