Adding type source info to CompoundLiteralExpr.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding type source info to CompoundLiteralExpr.

Enea Zaffanella
Hello.

The attached patch adds type source info to compound literals.

Cheers,
Enea.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

CompoundLiteralExpr.patch (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Adding type source info to CompoundLiteralExpr.

John McCall
On Jan 17, 2010, at 11:36 AM, Enea Zaffanella wrote:
> The attached patch adds type source info to compound literals.

Looks good!  Committed as r93752, with one tweak:

@@ -3849,15 +3849,17 @@
 template<typename Derived>
 Sema::OwningExprResult
 TreeTransform<Derived>::TransformCompoundLiteralExpr(CompoundLiteralExpr *E) {
-  QualType T;
+  TypeSourceInfo *OldT;
+  TypeSourceInfo *NewT;
   {
     // FIXME: Source location isn't quite accurate.
     SourceLocation FakeTypeLoc
       = SemaRef.PP.getLocForEndOfToken(E->getLParenLoc());
     TemporaryBase Rebase(*this, FakeTypeLoc, DeclarationName());
 
-    T = getDerived().TransformType(E->getType());
-    if (T.isNull())
+    OldT = E->getTypeSourceInfo();
+    NewT = getDerived().TransformType(OldT);
+    if (!NewT)
       return SemaRef.ExprError();
   }
 
This rebase is being done purely to give slightly better locations when rebuilding the type, so you can kill it since you're rebuilding an actual TypeSourceInfo.

John.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev