summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-01-26 01:33:06 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-01-26 01:33:06 +0000
commit16c88df1a0dc5cc4a42bbd82c9ed63cd6fb090eb (patch)
treeff52c8db5ae396adfcce3b31153905ab708dff7b
parent5eca265519e2c1545d9542b16bd484988dbc19d3 (diff)
downloadbcm5719-llvm-16c88df1a0dc5cc4a42bbd82c9ed63cd6fb090eb.tar.gz
bcm5719-llvm-16c88df1a0dc5cc4a42bbd82c9ed63cd6fb090eb.zip
PR3269: create an empty InitListExpr as a child for the
CompoundLiteralExpr so that there aren't any null pointers in the AST. llvm-svn: 62981
-rw-r--r--clang/lib/Sema/SemaExpr.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 1d55ed7c3aa..9b91ec6ee5f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -3987,9 +3987,13 @@ Sema::ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
// Otherwise, create a compound literal expression as the base, and
// iteratively process the offsetof designators.
- Expr *Res = new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, 0,
- false);
-
+ InitListExpr *IList =
+ new (Context) InitListExpr(SourceLocation(), 0, 0,
+ SourceLocation(), false);
+ IList->setType(ArgTy);
+ Expr *Res =
+ new (Context) CompoundLiteralExpr(SourceLocation(), ArgTy, IList, false);
+
// offsetof with non-identifier designators (e.g. "offsetof(x, a.b[c])") are a
// GCC extension, diagnose them.
if (NumComponents != 1)
OpenPOWER on IntegriCloud