diff options
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 87d81df..ac51bee 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -3717,6 +3717,7 @@ namespace { class DSAAttrChecker final : public StmtVisitor<DSAAttrChecker, void> { DSAStackTy *Stack; Sema &SemaRef; + OpenMPDirectiveKind DKind = OMPD_unknown; bool ErrorFound = false; bool TryCaptureCXXThisMembers = false; CapturedStmt *CS = nullptr; @@ -3748,7 +3749,7 @@ class DSAAttrChecker final : public StmtVisitor<DSAAttrChecker, void> { // Try to capture inner this->member references to generate correct mappings // and diagnostics. if (TryCaptureCXXThisMembers || - (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && + (isOpenMPTargetExecutionDirective(DKind) && llvm::any_of(S->getInnermostCapturedStmt()->captures(), [](const CapturedStmt::Capture &C) { return C.capturesThis(); @@ -3818,7 +3819,6 @@ public: return; SourceLocation ELoc = E->getExprLoc(); - OpenMPDirectiveKind DKind = Stack->getCurrentDirective(); // The default(none) clause requires that each variable that is referenced // in the construct, and does not have a predetermined data-sharing // attribute, must have its data-sharing attribute explicitly determined @@ -3983,7 +3983,6 @@ public: E->containsUnexpandedParameterPack() || E->isInstantiationDependent()) return; auto *FD = dyn_cast<FieldDecl>(E->getMemberDecl()); - OpenMPDirectiveKind DKind = Stack->getCurrentDirective(); if (auto *TE = dyn_cast<CXXThisExpr>(E->getBase()->IgnoreParenCasts())) { if (!FD) return; @@ -4065,8 +4064,7 @@ public: if (isOpenMPTargetExecutionDirective(DKind)) { OMPClauseMappableExprCommon::MappableExprComponentList CurComponents; if (!checkMapClauseExpressionBase(SemaRef, E, CurComponents, OMPC_map, - Stack->getCurrentDirective(), - /*NoDiagnose=*/true)) + DKind, /*NoDiagnose=*/true)) return; const auto *VD = cast<ValueDecl>( CurComponents.back().getAssociatedDeclaration()->getCanonicalDecl()); @@ -4119,8 +4117,7 @@ public: // Skip analysis of arguments of implicitly defined map clause for target // directives. if (C && !((isa<OMPFirstprivateClause>(C) || isa<OMPMapClause>(C)) && - C->isImplicit() && - !isOpenMPTaskingDirective(Stack->getCurrentDirective()))) { + C->isImplicit() && !isOpenMPTaskingDirective(DKind))) { for (Stmt *CC : C->children()) { if (CC) Visit(CC); @@ -4169,7 +4166,7 @@ public: VarDecl *VD = Cap.getCapturedVar(); // Do not try to map the variable if it or its sub-component was mapped // already. - if (isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()) && + if (isOpenMPTargetExecutionDirective(DKind) && Stack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, [](OMPClauseMappableExprCommon::MappableExprComponentListRef, @@ -4200,8 +4197,9 @@ public: DSAAttrChecker(DSAStackTy *S, Sema &SemaRef, CapturedStmt *CS) : Stack(S), SemaRef(SemaRef), ErrorFound(false), CS(CS) { + DKind = S->getCurrentDirective(); // Process declare target link variables for the target directives. - if (isOpenMPTargetExecutionDirective(S->getCurrentDirective())) { + if (isOpenMPTargetExecutionDirective(DKind)) { for (DeclRefExpr *E : Stack->getLinkGlobals()) Visit(E); } |