changeset 114:a6d007e4e7a3

in __code cleanup is done just before tail call (goto)
author mir3636
date Thu, 04 Aug 2016 19:27:15 +0900
parents b8d969d74b93
children 95b91bc9a2f8
files tools/clang/lib/CodeGen/CGCall.cpp tools/clang/lib/CodeGen/CGCleanup.cpp
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/lib/CodeGen/CGCall.cpp	Mon Jun 27 19:21:24 2016 +0900
+++ b/tools/clang/lib/CodeGen/CGCall.cpp	Thu Aug 04 19:27:15 2016 +0900
@@ -3459,7 +3459,10 @@
     assert(IRFunctionArgs.hasInallocaArg());
     IRCallArgs[IRFunctionArgs.getInallocaArgNo()] = Arg;
   }
-
+#ifndef noCbC
+  if (CGF.FnRetTy.getTypePtr()->is__CodeType()) //
+    Fn->Emit(CGF, flags);
+#endif
   if (!CallArgs.getCleanupsToDeactivate().empty())
     deactivateArgCleanupsBeforeCall(*this, CallArgs);
 
--- a/tools/clang/lib/CodeGen/CGCleanup.cpp	Mon Jun 27 19:21:24 2016 +0900
+++ b/tools/clang/lib/CodeGen/CGCleanup.cpp	Thu Aug 04 19:27:15 2016 +0900
@@ -511,7 +511,10 @@
   }
 
   // Ask the cleanup to emit itself.
-  Fn->Emit(CGF, flags);
+#ifndef noCbC
+  if (!CGF.FnRetTy.getTypePtr()->is__CodeType()) // in __code cleanup is done just before tail call (goto)
+#endif
+    Fn->Emit(CGF, flags);
   assert(CGF.HaveInsertPoint() && "cleanup ended with no insertion point?");
 
   // Emit the continuation block if there was an active flag.