[llvm-branch-commits] [clang] [clang][OpenMP] Switch OpenMP version from unsigned to llvm::omp::Version (PR #219821)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Aug 30 09:11:53 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
<sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
---
Patch is 41.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/219821.diff
8 Files Affected:
- (modified) clang/include/clang/AST/OpenMPClause.h (+3-2)
- (modified) clang/include/clang/ASTMatchers/ASTMatchers.h (+1-1)
- (modified) clang/include/clang/Basic/LangOptions.h (+6)
- (modified) clang/lib/AST/DeclPrinter.cpp (+3-3)
- (modified) clang/lib/AST/StmtPrinter.cpp (+6-9)
- (modified) clang/lib/Parse/ParseOpenMP.cpp (+16-16)
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+61-58)
- (modified) clang/lib/Sema/TreeTransform.h (+4-3)
``````````diff
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index db490ff9951b8..ec84f10956ff4 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -35,6 +35,7 @@
#include "llvm/Frontend/OpenMP/OMPAssume.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include "llvm/Frontend/OpenMP/OMPContext.h"
+#include "llvm/Frontend/OpenMP/OMPVersion.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/TrailingObjects.h"
@@ -10035,7 +10036,7 @@ class ConstOMPClauseVisitor :
class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
raw_ostream &OS;
const PrintingPolicy &Policy;
- unsigned Version;
+ llvm::omp::Version Version;
/// Process clauses with list of variables.
template <typename T> void VisitOMPClauseList(T *Node, char StartSym);
@@ -10044,7 +10045,7 @@ class OMPClausePrinter final : public OMPClauseVisitor<OMPClausePrinter> {
public:
OMPClausePrinter(raw_ostream &OS, const PrintingPolicy &Policy,
- unsigned OpenMPVersion)
+ llvm::omp::Version OpenMPVersion)
: OS(OS), Policy(Policy), Version(OpenMPVersion) {}
#define GEN_CLANG_CLAUSE_CLASS
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index 43cbeb3b40eac..c860d6856c568 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -8959,7 +8959,7 @@ AST_MATCHER_P(OMPExecutableDirective, isAllowedToContainClauseKind,
OpenMPClauseKind, CKind) {
return llvm::omp::isAllowedClauseForDirective(
Node.getDirectiveKind(), CKind,
- Finder->getASTContext().getLangOpts().OpenMP);
+ Finder->getASTContext().getLangOpts().getOpenMP());
}
/// Matches OpenMP ``from`` clause.
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index f21131622d03d..9fa698dc2a29a 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -25,6 +25,7 @@
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/DXContainer.h"
+#include "llvm/Frontend/OpenMP/OMPVersion.h"
#include "llvm/Support/AllocToken.h"
#include "llvm/TargetParser/Triple.h"
#include <optional>
@@ -822,6 +823,11 @@ class LangOptions : public LangOptionsBase {
return OpenMPIsTargetDevice || CUDAIsDevice || SYCLIsDevice;
}
+ /// Return the OpenMP version.
+ llvm::omp::Version getOpenMP() const {
+ return llvm::omp::Version(OpenMP);
+ }
+
/// Returns the most applicable C standard-compliant language version code.
/// If none could be determined, returns \ref std::nullopt.
std::optional<uint32_t> getCLangStd() const;
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 141ba50941685..5fdcf40ac8069 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -1886,7 +1886,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
Out << ")";
}
if (!D->clauselist_empty()) {
- OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
+ OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP());
for (OMPClause *C : D->clauselists()) {
Out << " ";
Printer.Visit(C);
@@ -1897,7 +1897,7 @@ void DeclPrinter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
void DeclPrinter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
Out << "#pragma omp requires ";
if (!D->clauselist_empty()) {
- OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
+ OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP());
for (auto I = D->clauselist_begin(), E = D->clauselist_end(); I != E; ++I)
Printer.Visit(*I);
}
@@ -1950,7 +1950,7 @@ void DeclPrinter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
Out << D->getVarName();
Out << ")";
if (!D->clauselist_empty()) {
- OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().OpenMP);
+ OMPClausePrinter Printer(Out, Policy, Context.getLangOpts().getOpenMP());
for (auto *C : D->clauselists()) {
Out << " ";
Printer.Visit(C);
diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp
index 3cab31a300028..c76a8226a04fe 100644
--- a/clang/lib/AST/StmtPrinter.cpp
+++ b/clang/lib/AST/StmtPrinter.cpp
@@ -779,9 +779,8 @@ void StmtPrinter::VisitOMPCanonicalLoop(OMPCanonicalLoop *Node) {
void StmtPrinter::PrintOMPExecutableDirective(OMPExecutableDirective *S,
bool ForceNoStmt) {
- unsigned OpenMPVersion =
- Context ? Context->getLangOpts().OpenMP
- : static_cast<unsigned>(llvm::omp::FallbackVersion);
+ llvm::omp::Version OpenMPVersion =
+ Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion;
OMPClausePrinter Printer(OS, Policy, OpenMPVersion);
ArrayRef<OMPClause *> Clauses = S->clauses();
for (auto *Clause : Clauses)
@@ -1026,18 +1025,16 @@ void StmtPrinter::VisitOMPTeamsDirective(OMPTeamsDirective *Node) {
void StmtPrinter::VisitOMPCancellationPointDirective(
OMPCancellationPointDirective *Node) {
- unsigned OpenMPVersion =
- Context ? Context->getLangOpts().OpenMP
- : static_cast<unsigned>(llvm::omp::FallbackVersion);
+ llvm::omp::Version OpenMPVersion =
+ Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion;
Indent() << "#pragma omp cancellation point "
<< getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion);
PrintOMPExecutableDirective(Node);
}
void StmtPrinter::VisitOMPCancelDirective(OMPCancelDirective *Node) {
- unsigned OpenMPVersion =
- Context ? Context->getLangOpts().OpenMP
- : static_cast<unsigned>(llvm::omp::FallbackVersion);
+ llvm::omp::Version OpenMPVersion =
+ Context ? Context->getLangOpts().getOpenMP() : llvm::omp::FallbackVersion;
Indent() << "#pragma omp cancel "
<< getOpenMPDirectiveName(Node->getCancelRegion(), OpenMPVersion);
PrintOMPExecutableDirective(Node);
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 4497fd488d79f..12bd48f9e32c3 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -162,7 +162,7 @@ static DeclarationName parseOpenMPReductionId(Parser &P) {
Parser::DeclGroupPtrTy
Parser::ParseOpenMPDeclareReductionDirective(AccessSpecifier AS) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
// Parse '('.
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(
@@ -407,7 +407,7 @@ void Parser::ParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm) {
Parser::DeclGroupPtrTy
Parser::ParseOpenMPDeclareMapperDirective(AccessSpecifier AS) {
bool IsCorrect = true;
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
// Parse '('
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(
@@ -686,7 +686,8 @@ static bool parseDeclareSimdClauses(
P.ConsumeToken();
} else if (ClauseName == "simdlen") {
if (SimdLen.isUsable()) {
- unsigned OMPVersion = P.getActions().getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion =
+ P.getActions().getLangOpts().getOpenMP();
P.Diag(Tok, diag::err_omp_more_one_clause)
<< getOpenMPDirectiveName(OMPD_declare_simd, OMPVersion)
<< ClauseName << 0;
@@ -1335,7 +1336,7 @@ bool Parser::parseOMPContextSelectors(SourceLocation Loc, OMPTraitInfo &TI) {
void Parser::ParseOMPDeclareVariantClauses(Parser::DeclGroupPtrTy Ptr,
CachedTokens &Toks,
SourceLocation Loc) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
PP.EnterToken(Tok, /*IsReinject*/ true);
PP.EnterTokenStream(Toks, /*DisableMacroExpansion=*/true,
/*IsReinject*/ true);
@@ -1388,8 +1389,7 @@ void Parser::ParseOMPDeclareVariantClauses(Parser::DeclGroupPtrTy Ptr,
OpenMPClauseKind CKind = Tok.isAnnotation()
? OMPC_unknown
: getOpenMPClauseKind(PP.getSpelling(Tok));
- if (!isAllowedClauseForDirective(OMPD_declare_variant, CKind,
- getLangOpts().OpenMP)) {
+ if (!isAllowedClauseForDirective(OMPD_declare_variant, CKind, OMPVersion)) {
Diag(Tok.getLocation(), diag::err_omp_declare_variant_wrong_clause)
<< (getLangOpts().OpenMP < 51 ? 0 : 1);
IsError = true;
@@ -1665,7 +1665,7 @@ void Parser::ParseOpenMPAssumesDirective(OpenMPDirectiveKind DKind,
bool NextIsLPar = Tok.is(tok::l_paren);
// Handle unknown clauses by skipping them.
if (Idx == -1) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
Diag(StartLoc, diag::warn_omp_unknown_assumption_clause_missing_id)
<< llvm::omp::getOpenMPDirectiveName(DKind, OMPVersion)
<< llvm::omp::getAllAssumeClauseOptions() << NextIsLPar;
@@ -1781,7 +1781,7 @@ void Parser::ParseOMPDeclareTargetClauses(
getOpenMPClauseKind(ClauseName) == OMPC_indirect;
if (DTCI.Indirect && IsIndirectClause) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
Diag(Tok, diag::err_omp_more_one_clause)
<< getOpenMPDirectiveName(OMPD_declare_target, OMPVersion)
<< getOpenMPClauseName(OMPC_indirect) << 0;
@@ -1933,7 +1933,7 @@ void Parser::skipUntilPragmaOpenMPEnd(OpenMPDirectiveKind DKind) {
if (Tok.is(tok::annot_pragma_openmp_end))
return;
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
Diag(Tok, diag::warn_omp_extra_tokens_at_eol)
<< getOpenMPDirectiveName(DKind, OMPVersion);
while (Tok.isNot(tok::annot_pragma_openmp_end))
@@ -1954,7 +1954,7 @@ void Parser::parseOMPEndDirective(OpenMPDirectiveKind BeginKind,
return;
}
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
Diag(FoundLoc, diag::err_expected_end_declare_target_or_variant)
<< DiagSelection;
Diag(BeginLoc, diag::note_matching)
@@ -1982,7 +1982,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl(
"Not an OpenMP directive!");
ParsingOpenMPDirectiveRAII DirScope(*this);
ParenBraceBracketBalancer BalancerRAIIObj(*this);
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
SourceLocation Loc;
OpenMPDirectiveKind DKind;
@@ -2303,7 +2303,7 @@ StmtResult Parser::ParseOpenMPExecutableDirective(
ParsedStmtContext StmtCtx, OpenMPDirectiveKind DKind, SourceLocation Loc,
bool ReadDirectiveWithinMetadirective) {
assert(isOpenMPExecutableDirective(DKind) && "Unexpected directive category");
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
bool HasAssociatedStatement = true;
Association Assoc = getDirectiveAssociation(DKind);
@@ -2573,7 +2573,7 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective(
SourceLocation Loc = ReadDirectiveWithinMetadirective
? Tok.getLocation()
: ConsumeAnnotationToken();
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
OpenMPDirectiveKind DKind = parseOpenMPDirectiveKind(*this);
if (ReadDirectiveWithinMetadirective && DKind == OMPD_unknown) {
Diag(Tok, diag::err_omp_unknown_directive);
@@ -2953,7 +2953,7 @@ bool Parser::ParseOpenMPSimpleVarList(
const llvm::function_ref<void(CXXScopeSpec &, DeclarationNameInfo)>
&Callback,
bool AllowScopeSpecifier) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
// Parse '('.
BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end);
if (T.expectAndConsume(diag::err_expected_lparen_after,
@@ -3239,7 +3239,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OMPClause *Clause = nullptr;
bool ErrorFound = false;
bool WrongDirective = false;
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
auto CheckClauseValid = [&](OpenMPDirectiveKind D, OpenMPClauseKind C) {
if (!isAllowedClauseForDirective(D, C, OMPVersion)) {
@@ -5490,7 +5490,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
else if (Tok.isNot(tok::r_paren) &&
Tok.isNot(tok::annot_pragma_openmp_end) &&
(!MayHaveTail || Tok.isNot(tok::colon))) {
- unsigned OMPVersion = Actions.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = Actions.getLangOpts().getOpenMP();
Diag(Tok, diag::err_omp_expected_punc)
<< ((Kind == OMPC_flush)
? getOpenMPDirectiveName(OMPD_flush, OMPVersion)
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 7ddda157dad9d..d5ea6f259ff09 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -46,6 +46,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Frontend/OpenMP/OMPAssume.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
+#include "llvm/Frontend/OpenMP/OMPVersion.h"
#include "llvm/IR/Assumptions.h"
#include <optional>
@@ -3167,7 +3168,7 @@ ExprResult SemaOpenMP::ActOnOpenMPIdExpression(Scope *CurScope,
const DeclarationNameInfo &Id,
OpenMPDirectiveKind Kind) {
ASTContext &Context = getASTContext();
- unsigned OMPVersion = getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = getLangOpts().getOpenMP();
LookupResult Lookup(SemaRef, Id, Sema::LookupOrdinaryName);
SemaRef.LookupParsedName(Lookup, CurScope, &ScopeSpec,
/*ObjectType=*/QualType(),
@@ -3310,9 +3311,9 @@ SemaOpenMP::ActOnOpenMPThreadprivateDirective(SourceLocation Loc,
SemaOpenMP::DeclGroupPtrTy
SemaOpenMP::ActOnOpenMPGroupPrivateDirective(SourceLocation Loc,
ArrayRef<Expr *> VarList) {
- if (!getLangOpts().OpenMP || getLangOpts().OpenMP < 60) {
+ if (!getLangOpts().OpenMP || getLangOpts().getOpenMP() < 60) {
Diag(Loc, diag::err_omp_unexpected_directive)
- << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().OpenMP);
+ << getOpenMPDirectiveName(OMPD_groupprivate, getLangOpts().getOpenMP());
return nullptr;
}
if (OMPGroupPrivateDecl *D = CheckOMPGroupPrivateDecl(Loc, VarList)) {
@@ -3383,7 +3384,7 @@ SemaOpenMP::CheckOMPThreadPrivateDecl(SourceLocation Loc,
// OpenMP [2.9.2, Restrictions, C/C++, p.10]
// A threadprivate variable must not have a reference type.
if (VD->getType()->isReferenceType()) {
- unsigned OMPVersion = getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = getLangOpts().getOpenMP();
Diag(ILoc, diag::err_omp_ref_type_arg)
<< getOpenMPDirectiveName(OMPD_threadprivate, OMPVersion)
<< VD->getType();
@@ -3702,7 +3703,7 @@ void SemaOpenMP::ActOnOpenMPAssumesDirective(SourceLocation Loc,
ArrayRef<std::string> Assumptions,
bool SkippedClauses) {
if (!SkippedClauses && Assumptions.empty()) {
- unsigned OMPVersion = getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = getLangOpts().getOpenMP();
Diag(Loc, diag::err_omp_no_clause_for_directive)
<< llvm::omp::getAllAssumeClauseOptions()
<< llvm::omp::getOpenMPDirectiveName(DKind, OMPVersion);
@@ -3854,7 +3855,7 @@ static void reportOriginalDsa(Sema &SemaRef, const DSAStackTy *Stack,
Reason = PDSA_LocalVarPrivate;
}
if (Reason != PDSA_Implicit) {
- unsigned OMPVersion = SemaRef.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP();
SemaRef.Diag(ReportLoc, diag::note_omp_predetermined_dsa)
<< Reason << ReportHint
<< getOpenMPDirectiveName(Stack->getCurrentDirective(), OMPVersion);
@@ -4923,7 +4924,7 @@ StmtResult SemaOpenMP::ActOnOpenMPRegionEnd(StmtResult S,
if (isOpenMPWorksharingDirective(DSAStack->getCurrentDirective()) &&
isOpenMPSimdDirective(DSAStack->getCurrentDirective()) && OC &&
OC->getNumForLoops()) {
- unsigned OMPVersion = getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = getLangOpts().getOpenMP();
Diag(OC->getBeginLoc(), diag::err_omp_ordered_simd)
<< getOpenMPDirectiveName(DSAStack->getCurrentDirective(), OMPVersion);
ErrorFound = true;
@@ -5005,7 +5006,7 @@ static bool checkCancelRegion(Sema &SemaRef, OpenMPDirectiveKind CurrentRegion,
CancelRegion == OMPD_sections || CancelRegion == OMPD_taskgroup)
return false;
- unsigned OMPVersion = SemaRef.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP();
SemaRef.Diag(StartLoc, diag::err_omp_wrong_cancel_region)
<< getOpenMPDirectiveName(CancelRegion, OMPVersion);
return true;
@@ -5038,7 +5039,7 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
ArrayRef<OpenMPDirectiveKind> ParentLOC =
getLeafOrCompositeConstructs(ParentRegion, LeafOrComposite);
OpenMPDirectiveKind EnclosingConstruct = ParentLOC.back();
- unsigned OMPVersion = SemaRef.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMP();
if (OMPVersion >= 50 && Stack->isParentOrderConcurrent() &&
!isOpenMPOrderConcurrentNestableDirective(CurrentRegion,
@@ -5314,7 +5315,7 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
llvm::IndexedMap<const OMPIfClause *, Kind2Unsigned> FoundNameModifiers;
FoundNameModifiers.resize(llvm::omp::Directive_enumSize + 1);
SmallVector<SourceLocation, 4> NameModifierLoc;
- unsigned OMPVersion = S.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = S.getLangOpts().getOpenMP();
for (const OMPClause *C : Clauses) {
if (const auto *IC = dyn_cast_or_null<OMPIfClause>(C)) {
// At most one if clause without a directive-name-modifier can appear on
@@ -5592,7 +5593,7 @@ static void checkAllocateClauses(Sema &S, DSAStackTy *Stack,
if (AllocatorKind == OMPAllocateDeclAttr::OMPThreadMemAlloc &&
(isOpenMPTaskingDirective(Stack->getCurrentDirective()) ||
isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()))) {
- unsigned OMPVersion = S.getLangOpts().OpenMP;
+ llvm::omp::Version OMPVersion = S.getLangOpts().getOpenMP();
S.Diag(AC->getAllocator()->getExprLoc(),
diag::warn_omp_allocate_thread_on_task_target_directive)
<< getOpenMPDirectiveName(Stack->getCurrentDirective(), OMPVersion);
@@ -6946,7 +6947,7 @@ StmtResult SemaOpenMP::ActOnOpenMPExecutableDirective(
llvm::SmallVector<OpenMPDirectiveKind, 4> AllowedNameModifiers;
for (OpenMPDirectiveKind D : getLeafConstructsOrSelf(Kind)) {
- if (isAllowedClauseForDirective(D, OMPC_if, getLangOpts().OpenMP))
+ if (isAllowedClauseForDirective(D, OMPC_if, getLangOpts().getOpenMP()))
AllowedNameModifiers.push_back(D);
}
if (!AllowedNameModifiers.empty())
@@ -9592,7 +9593,7 @@ void SemaOpenMP::ActOnOpenMPLoopInitialization(SourceLocation ForLoc,
!isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) &&
(DVar.CKind != OMPC_private || DVar.RefExpr)) {
- unsi...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/219821
More information about the llvm-branch-commits
mailing list