aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/mod-file.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>2025-05-09 07:42:15 -0500
committerKrzysztof Parzyszek <Krzysztof.Parzyszek@amd.com>2025-05-09 08:13:52 -0500
commita68f35a17db03a6633a660d310156f4e2f17197f (patch)
tree0d109600cd405a2a571f83ebd9e6a74d3cd4f0ee /flang/lib/Semantics/mod-file.cpp
parentdbe561309a1cb35e11cc57e4b88096362a030e8a (diff)
downloadllvm-a68f35a17db03a6633a660d310156f4e2f17197f.zip
llvm-a68f35a17db03a6633a660d310156f4e2f17197f.tar.gz
llvm-a68f35a17db03a6633a660d310156f4e2f17197f.tar.bz2
[flang][OpenMP] Pass OpenMP version to getOpenMPDirectiveName (#139131)
The OpenMP version is stored in LangOptions in SemanticsContext. Use the fallback version where SemanticsContext is unavailable (mostly in case of debug dumps). RFC: https://discourse.llvm.org/t/rfc-alternative-spellings-of-openmp-directives/85507 Reland with a fix for build break in f18-parse-demo.
Diffstat (limited to 'flang/lib/Semantics/mod-file.cpp')
-rw-r--r--flang/lib/Semantics/mod-file.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp
index ee356e5..12fc553 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 *);
+ const parser::Expr *, SemanticsContext &);
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);
+ PutInit(decls_, *ref, object->init(), nullptr, context_);
emittedDECFields_.insert(*ref);
} else if (any) {
break; // any later use of this structure will use RECORD/str/
@@ -944,7 +944,8 @@ void ModFileWriter::PutObjectEntity(
getSymbolAttrsToWrite(symbol));
PutShape(os, details.shape(), '(', ')');
PutShape(os, details.coshape(), '[', ']');
- PutInit(os, symbol, details.init(), details.unanalyzedPDTComponentInit());
+ PutInit(os, symbol, details.init(), details.unanalyzedPDTComponentInit(),
+ context_);
os << '\n';
if (auto tkr{GetIgnoreTKR(symbol)}; !tkr.empty()) {
os << "!dir$ ignore_tkr(";
@@ -1036,11 +1037,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) {
+ const parser::Expr *unanalyzed, SemanticsContext &context) {
if (IsNamedConstant(symbol) || symbol.owner().IsDerivedType()) {
const char *assign{symbol.attrs().test(Attr::POINTER) ? "=>" : "="};
if (unanalyzed) {
- parser::Unparse(os << assign, *unanalyzed);
+ parser::Unparse(os << assign, *unanalyzed, context.langOptions());
} else if (init) {
init->AsFortran(os << assign);
}