aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/mod-file.cpp
diff options
context:
space:
mode:
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);
}