diff options
author | Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> | 2025-05-09 07:55:13 -0500 |
---|---|---|
committer | Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> | 2025-05-09 07:56:10 -0500 |
commit | 89822ff5a8608570897c21a3c40fb450c53f603f (patch) | |
tree | 13175fc9ffe168eb8e0a1619811988729c0a171a /flang/lib/Semantics | |
parent | bb0a0782ea63e94154d2c8653e0064e4321a1f20 (diff) | |
download | llvm-89822ff5a8608570897c21a3c40fb450c53f603f.zip llvm-89822ff5a8608570897c21a3c40fb450c53f603f.tar.gz llvm-89822ff5a8608570897c21a3c40fb450c53f603f.tar.bz2 |
Revert "[flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (#139131)"
This reverts commit 41aa67488c3ca33334ec79fb5216145c3644277c.
Breaks build: https://lab.llvm.org/buildbot/#/builders/140/builds/22826
Diffstat (limited to 'flang/lib/Semantics')
-rw-r--r-- | flang/lib/Semantics/check-omp-structure.cpp | 18 | ||||
-rw-r--r-- | flang/lib/Semantics/mod-file.cpp | 11 | ||||
-rw-r--r-- | flang/lib/Semantics/resolve-directives.cpp | 25 | ||||
-rw-r--r-- | flang/lib/Semantics/unparse-with-symbols.cpp | 6 |
4 files changed, 26 insertions, 34 deletions
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp index 8f6a623..dd8e511 100644 --- a/flang/lib/Semantics/check-omp-structure.cpp +++ b/flang/lib/Semantics/check-omp-structure.cpp @@ -2434,7 +2434,8 @@ void OmpStructureChecker::Enter( break; default: context_.Say(dirName.source, "%s is not a cancellable construct"_err_en_US, - parser::ToUpperCaseLetters(getDirectiveName(dirName.v).str())); + parser::ToUpperCaseLetters( + llvm::omp::getOpenMPDirectiveName(dirName.v).str())); break; } } @@ -2467,7 +2468,7 @@ std::optional<llvm::omp::Directive> OmpStructureChecker::GetCancelType( // Given clauses from CANCEL or CANCELLATION_POINT, identify the construct // to which the cancellation applies. std::optional<llvm::omp::Directive> cancelee; - llvm::StringRef cancelName{getDirectiveName(cancelDir)}; + llvm::StringRef cancelName{llvm::omp::getOpenMPDirectiveName(cancelDir)}; for (const parser::OmpClause &clause : maybeClauses->v) { using CancellationConstructType = @@ -2495,7 +2496,7 @@ std::optional<llvm::omp::Directive> OmpStructureChecker::GetCancelType( void OmpStructureChecker::CheckCancellationNest( const parser::CharBlock &source, llvm::omp::Directive type) { - llvm::StringRef typeName{getDirectiveName(type)}; + llvm::StringRef typeName{llvm::omp::getOpenMPDirectiveName(type)}; if (CurrentDirectiveIsNested()) { // If construct-type-clause is taskgroup, the cancellation construct must be @@ -4059,10 +4060,10 @@ void OmpStructureChecker::Enter(const parser::OmpClause::If &x) { if (auto *dnm{OmpGetUniqueModifier<parser::OmpDirectiveNameModifier>( modifiers)}) { llvm::omp::Directive sub{dnm->v}; - std::string subName{ - parser::ToUpperCaseLetters(getDirectiveName(sub).str())}; - std::string dirName{ - parser::ToUpperCaseLetters(getDirectiveName(dir).str())}; + std::string subName{parser::ToUpperCaseLetters( + llvm::omp::getOpenMPDirectiveName(sub).str())}; + std::string dirName{parser::ToUpperCaseLetters( + llvm::omp::getOpenMPDirectiveName(dir).str())}; parser::CharBlock modifierSource{OmpGetModifierSource(modifiers, dnm)}; auto desc{OmpGetDescriptor<parser::OmpDirectiveNameModifier>()}; @@ -5432,8 +5433,7 @@ llvm::StringRef OmpStructureChecker::getClauseName(llvm::omp::Clause clause) { llvm::StringRef OmpStructureChecker::getDirectiveName( llvm::omp::Directive directive) { - unsigned version{context_.langOptions().OpenMPVersion}; - return llvm::omp::getOpenMPDirectiveName(directive, version); + return llvm::omp::getOpenMPDirectiveName(directive); } const Symbol *OmpStructureChecker::GetObjectSymbol( diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp index 12fc553..ee356e5 100644 --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -50,7 +50,7 @@ static void CollectSymbols( const Scope &, SymbolVector &, SymbolVector &, SourceOrderedSymbolSet &); static void PutPassName(llvm::raw_ostream &, const std::optional<SourceName> &); static void PutInit(llvm::raw_ostream &, const Symbol &, const MaybeExpr &, - const parser::Expr *, SemanticsContext &); + const parser::Expr *); static void PutInit(llvm::raw_ostream &, const MaybeIntExpr &); static void PutBound(llvm::raw_ostream &, const Bound &); static void PutShapeSpec(llvm::raw_ostream &, const ShapeSpec &); @@ -605,7 +605,7 @@ void ModFileWriter::PutDECStructure( } decls_ << ref->name(); PutShape(decls_, object->shape(), '(', ')'); - PutInit(decls_, *ref, object->init(), nullptr, context_); + PutInit(decls_, *ref, object->init(), nullptr); emittedDECFields_.insert(*ref); } else if (any) { break; // any later use of this structure will use RECORD/str/ @@ -944,8 +944,7 @@ void ModFileWriter::PutObjectEntity( getSymbolAttrsToWrite(symbol)); PutShape(os, details.shape(), '(', ')'); PutShape(os, details.coshape(), '[', ']'); - PutInit(os, symbol, details.init(), details.unanalyzedPDTComponentInit(), - context_); + PutInit(os, symbol, details.init(), details.unanalyzedPDTComponentInit()); os << '\n'; if (auto tkr{GetIgnoreTKR(symbol)}; !tkr.empty()) { os << "!dir$ ignore_tkr("; @@ -1037,11 +1036,11 @@ void ModFileWriter::PutTypeParam(llvm::raw_ostream &os, const Symbol &symbol) { } void PutInit(llvm::raw_ostream &os, const Symbol &symbol, const MaybeExpr &init, - const parser::Expr *unanalyzed, SemanticsContext &context) { + const parser::Expr *unanalyzed) { if (IsNamedConstant(symbol) || symbol.owner().IsDerivedType()) { const char *assign{symbol.attrs().test(Attr::POINTER) ? "=>" : "="}; if (unanalyzed) { - parser::Unparse(os << assign, *unanalyzed, context.langOptions()); + parser::Unparse(os << assign, *unanalyzed); } else if (init) { init->AsFortran(os << assign); } diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp index 6053153..8b1caca 100644 --- a/flang/lib/Semantics/resolve-directives.cpp +++ b/flang/lib/Semantics/resolve-directives.cpp @@ -1887,7 +1887,6 @@ std::int64_t OmpAttributeVisitor::GetAssociatedLoopLevelFromClauses( // construct with multiple associated do-loops are lastprivate. void OmpAttributeVisitor::PrivatizeAssociatedLoopIndexAndCheckLoopLevel( const parser::OpenMPLoopConstruct &x) { - unsigned version{context_.langOptions().OpenMPVersion}; std::int64_t level{GetContext().associatedLoopLevel}; if (level <= 0) { return; @@ -1923,8 +1922,7 @@ void OmpAttributeVisitor::PrivatizeAssociatedLoopIndexAndCheckLoopLevel( context_.Say(GetContext().directiveSource, "A DO loop must follow the %s directive"_err_en_US, parser::ToUpperCaseLetters( - llvm::omp::getOpenMPDirectiveName(GetContext().directive, version) - .str())); + llvm::omp::getOpenMPDirectiveName(GetContext().directive).str())); } } void OmpAttributeVisitor::CheckAssocLoopLevel( @@ -2444,7 +2442,6 @@ static bool SymbolOrEquivalentIsInNamelist(const Symbol &symbol) { void OmpAttributeVisitor::ResolveOmpObject( const parser::OmpObject &ompObject, Symbol::Flag ompFlag) { - unsigned version{context_.langOptions().OpenMPVersion}; common::visit( common::visitors{ [&](const parser::Designator &designator) { @@ -2467,7 +2464,7 @@ void OmpAttributeVisitor::ResolveOmpObject( Symbol::OmpFlagToClauseName(secondOmpFlag), parser::ToUpperCaseLetters( llvm::omp::getOpenMPDirectiveName( - GetContext().directive, version) + GetContext().directive) .str())); } }; @@ -2503,7 +2500,7 @@ void OmpAttributeVisitor::ResolveOmpObject( "in which the %s directive appears"_err_en_US, parser::ToUpperCaseLetters( llvm::omp::getOpenMPDirectiveName( - GetContext().directive, version) + GetContext().directive) .str())); } if (ompFlag == Symbol::Flag::OmpReduction) { @@ -2927,7 +2924,6 @@ void OmpAttributeVisitor::CheckSourceLabel(const parser::Label &label) { void OmpAttributeVisitor::CheckLabelContext(const parser::CharBlock source, const parser::CharBlock target, std::optional<DirContext> sourceContext, std::optional<DirContext> targetContext) { - unsigned version{context_.langOptions().OpenMPVersion}; if (targetContext && (!sourceContext || (sourceContext->scope != targetContext->scope && @@ -2936,8 +2932,8 @@ void OmpAttributeVisitor::CheckLabelContext(const parser::CharBlock source, context_ .Say(source, "invalid branch into an OpenMP structured block"_err_en_US) .Attach(target, "In the enclosing %s directive branched into"_en_US, - parser::ToUpperCaseLetters(llvm::omp::getOpenMPDirectiveName( - targetContext->directive, version) + parser::ToUpperCaseLetters( + llvm::omp::getOpenMPDirectiveName(targetContext->directive) .str())); } if (sourceContext && @@ -2949,8 +2945,8 @@ void OmpAttributeVisitor::CheckLabelContext(const parser::CharBlock source, .Say(source, "invalid branch leaving an OpenMP structured block"_err_en_US) .Attach(target, "Outside the enclosing %s directive"_en_US, - parser::ToUpperCaseLetters(llvm::omp::getOpenMPDirectiveName( - sourceContext->directive, version) + parser::ToUpperCaseLetters( + llvm::omp::getOpenMPDirectiveName(sourceContext->directive) .str())); } } @@ -2983,14 +2979,12 @@ void OmpAttributeVisitor::CheckNameInAllocateStmt( } } } - unsigned version{context_.langOptions().OpenMPVersion}; context_.Say(source, "Object '%s' in %s directive not " "found in corresponding ALLOCATE statement"_err_en_US, name.ToString(), parser::ToUpperCaseLetters( - llvm::omp::getOpenMPDirectiveName(GetContext().directive, version) - .str())); + llvm::omp::getOpenMPDirectiveName(GetContext().directive).str())); } void OmpAttributeVisitor::AddOmpRequiresToScope(Scope &scope, @@ -3036,10 +3030,9 @@ void OmpAttributeVisitor::IssueNonConformanceWarning( llvm::omp::Directive D, parser::CharBlock source) { std::string warnStr; llvm::raw_string_ostream warnStrOS(warnStr); - unsigned version{context_.langOptions().OpenMPVersion}; warnStrOS << "OpenMP directive " << parser::ToUpperCaseLetters( - llvm::omp::getOpenMPDirectiveName(D, version).str()) + llvm::omp::getOpenMPDirectiveName(D).str()) << " has been deprecated"; auto setAlternativeStr = [&warnStrOS](llvm::StringRef alt) { diff --git a/flang/lib/Semantics/unparse-with-symbols.cpp b/flang/lib/Semantics/unparse-with-symbols.cpp index 634d46b..2716d88 100644 --- a/flang/lib/Semantics/unparse-with-symbols.cpp +++ b/flang/lib/Semantics/unparse-with-symbols.cpp @@ -107,13 +107,13 @@ void SymbolDumpVisitor::Post(const parser::Name &name) { } void UnparseWithSymbols(llvm::raw_ostream &out, const parser::Program &program, - const common::LangOptions &langOpts, parser::Encoding encoding) { + parser::Encoding encoding) { SymbolDumpVisitor visitor; parser::Walk(program, visitor); parser::preStatementType preStatement{ [&](const parser::CharBlock &location, llvm::raw_ostream &out, int indent) { visitor.PrintSymbols(location, out, indent); }}; - parser::Unparse(out, program, langOpts, encoding, false, true, &preStatement); + parser::Unparse(out, program, encoding, false, true, &preStatement); } // UnparseWithModules() @@ -150,6 +150,6 @@ void UnparseWithModules(llvm::raw_ostream &out, SemanticsContext &context, for (SymbolRef moduleRef : visitor.modulesUsed()) { writer.WriteClosure(out, *moduleRef, nonIntrinsicModulesWritten); } - parser::Unparse(out, program, context.langOptions(), encoding, false, true); + parser::Unparse(out, program, encoding, false, true); } } // namespace Fortran::semantics |