[cfe-commits] r149441 - in /cfe/trunk: lib/Sema/SemaStmt.cpp lib/Sema/TreeTransform.h test/SemaCXX/indirect-goto.cpp

Eli Friedman eli.friedman at gmail.com
Tue Jan 31 14:47:07 PST 2012


Author: efriedma
Date: Tue Jan 31 16:47:07 2012
New Revision: 149441

URL: http://llvm.org/viewvc/llvm-project?rev=149441&view=rev
Log:
Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.


Added:
    cfe/trunk/test/SemaCXX/indirect-goto.cpp
Modified:
    cfe/trunk/lib/Sema/SemaStmt.cpp
    cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmt.cpp?rev=149441&r1=149440&r2=149441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmt.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmt.cpp Tue Jan 31 16:47:07 2012
@@ -1611,6 +1611,7 @@
     E = ExprRes.take();
     if (DiagnoseAssignmentResult(ConvTy, StarLoc, DestTy, ETy, E, AA_Passing))
       return StmtError();
+    E = MaybeCreateExprWithCleanups(E);
   }
 
   getCurFunction()->setHasIndirectGoto();

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=149441&r1=149440&r2=149441&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Jan 31 16:47:07 2012
@@ -5326,6 +5326,7 @@
   ExprResult Target = getDerived().TransformExpr(S->getTarget());
   if (Target.isInvalid())
     return StmtError();
+  Target = SemaRef.MaybeCreateExprWithCleanups(Target.take());
 
   if (!getDerived().AlwaysRebuild() &&
       Target.get() == S->getTarget())

Added: cfe/trunk/test/SemaCXX/indirect-goto.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/indirect-goto.cpp?rev=149441&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/indirect-goto.cpp (added)
+++ cfe/trunk/test/SemaCXX/indirect-goto.cpp Tue Jan 31 16:47:07 2012
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace test1 {
+  // Make sure this doesn't crash.
+  struct A { ~A(); };
+  void a() { goto *(A(), &&L); L: return; }
+}





More information about the cfe-commits mailing list