[cfe-commits] r62981 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Eli Friedman eli.friedman at gmail.com
Sun Jan 25 17:33:07 PST 2009


Author: efriedma
Date: Sun Jan 25 19:33:06 2009
New Revision: 62981

URL: http://llvm.org/viewvc/llvm-project?rev=62981&view=rev
Log:
PR3269: create an empty InitListExpr as a child for the 
CompoundLiteralExpr so that there aren't any null pointers in the AST.


Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=62981&r1=62980&r2=62981&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Jan 25 19:33:06 2009
@@ -3987,9 +3987,13 @@
   
   // 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)





More information about the cfe-commits mailing list