[llvm-branch-commits] [cfe-branch] r287033 - Merging r287025:

Alexey Bataev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Nov 15 13:24:19 PST 2016


Author: abataev
Date: Tue Nov 15 15:24:19 2016
New Revision: 287033

URL: http://llvm.org/viewvc/llvm-project?rev=287033&view=rev
Log:
Merging r287025:
------------------------------------------------------------------------
r287025 | abataev | 2016-11-15 20:57:18 +0000 (Tue, 15 Nov 2016) | 3 lines

[OPENMP] Fix stack use after delete, NFC.

Fixed possible use of stack variable after deletion.
------------------------------------------------------------------------

Modified:
    cfe/branches/release_39/   (props changed)
    cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp

Propchange: cfe/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 15 15:24:19 2016
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,284229,286103,286106,286129,286584,286944,286953
+/cfe/trunk:275880,275967,276102,276350,276361,276473,276653,276716,276887,276891,276900,276979,276983,277095,277138,277141,277221,277307,277522,277743,277783,277796-277797,277852,277866,277889,277900,278139,278156,278234-278235,278393,278395,278763,278786,278988,284110,284229,286103,286106,286129,286584,286944,286953,287025
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp?rev=287033&r1=287032&r2=287033&view=diff
==============================================================================
--- cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/branches/release_39/lib/CodeGen/CGStmtOpenMP.cpp Tue Nov 15 15:24:19 2016
@@ -2187,6 +2187,7 @@ void CodeGenFunction::EmitSections(const
   bool HasLastprivates = false;
   auto &&CodeGen = [&S, Stmt, CS, &HasLastprivates](CodeGenFunction &CGF,
                                                     PrePostActionTy &) {
+    OMPCancelStackRAII CancelRegion(CGF);
     auto &C = CGF.CGM.getContext();
     auto KmpInt32Ty = C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/1);
     // Emit helper vars inits.
@@ -2282,11 +2283,11 @@ void CodeGenFunction::EmitSections(const
                          [](CodeGenFunction &) {});
     // Tell the runtime we are done.
     SourceLocation ELoc = S.getLocEnd();
-    auto &&CodeGen = [ELoc](CodeGenFunction &CGF) {
+    auto &&FinalCodeGen = [ELoc](CodeGenFunction &CGF) {
       CGF.CGM.getOpenMPRuntime().emitForStaticFinish(CGF, ELoc);
     };
-    CodeGen(CGF);
-    CGF.OMPCancelStack.back().CodeGen = CodeGen;
+    FinalCodeGen(CGF);
+    CGF.OMPCancelStack.back().CodeGen = FinalCodeGen;
     CGF.EmitOMPReductionClauseFinal(S);
     // Emit post-update of the reduction variables if IsLastIter != 0.
     emitPostUpdateForReductionClause(
@@ -2324,7 +2325,6 @@ void CodeGenFunction::EmitSections(const
 void CodeGenFunction::EmitOMPSectionsDirective(const OMPSectionsDirective &S) {
   {
     OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
-    OMPCancelStackRAII CancelRegion(*this);
     EmitSections(S);
   }
   // Emit an implicit barrier at the end.
@@ -2433,7 +2433,6 @@ void CodeGenFunction::EmitOMPParallelSec
   // Emit directive as a combined directive that consists of two implicit
   // directives: 'parallel' with 'sections' directive.
   auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
-    OMPCancelStackRAII CancelRegion(CGF);
     CGF.EmitSections(S);
   };
   emitCommonOMPParallelDirective(*this, S, OMPD_sections, CodeGen);




More information about the llvm-branch-commits mailing list