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
This commit is contained in:
Eli Friedman 2009-01-26 01:33:06 +00:00
parent 5eca265519
commit 16c88df1a0
1 changed files with 7 additions and 3 deletions

View File

@ -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)