diff options
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 10b37557802..bfb98413a8a 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -13000,21 +13000,6 @@ bool Sema::tryCaptureVariable( if (isVariableAlreadyCapturedInScopeInfo(CSI, Var, Nested, CaptureType, DeclRefType)) break; - if (getLangOpts().OpenMP) { - if (auto *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) { - // OpenMP private variables should not be captured in outer scope, so - // just break here. - if (RSI->CapRegionKind == CR_OpenMP) { - if (isOpenMPPrivateVar(Var, OpenMPLevel)) { - Nested = true; - DeclRefType = DeclRefType.getUnqualifiedType(); - CaptureType = Context.getLValueReferenceType(DeclRefType); - break; - } - ++OpenMPLevel; - } - } - } // If we are instantiating a generic lambda call operator body, // we do not want to capture new variables. What was captured // during either a lambdas transformation or initial parsing @@ -13160,6 +13145,21 @@ bool Sema::tryCaptureVariable( } while (!QTy.isNull() && QTy->isVariablyModifiedType()); } + if (getLangOpts().OpenMP) { + if (auto *RSI = dyn_cast<CapturedRegionScopeInfo>(CSI)) { + // OpenMP private variables should not be captured in outer scope, so + // just break here. + if (RSI->CapRegionKind == CR_OpenMP) { + if (isOpenMPPrivateVar(Var, OpenMPLevel)) { + Nested = true; + DeclRefType = DeclRefType.getUnqualifiedType(); + CaptureType = Context.getLValueReferenceType(DeclRefType); + break; + } + ++OpenMPLevel; + } + } + } if (CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_None && !Explicit) { // No capture-default, and this is not an explicit capture // so cannot capture this variable. |