diff --git a/flang/lib/Semantics/mod-file.h b/flang/lib/Semantics/mod-file.h --- a/flang/lib/Semantics/mod-file.h +++ b/flang/lib/Semantics/mod-file.h @@ -32,7 +32,7 @@ class ModFileWriter { public: - ModFileWriter(SemanticsContext &context) : context_{context} {} + explicit ModFileWriter(SemanticsContext &context) : context_{context} {} bool WriteAll(); private: diff --git a/flang/lib/Semantics/mod-file.cpp b/flang/lib/Semantics/mod-file.cpp --- a/flang/lib/Semantics/mod-file.cpp +++ b/flang/lib/Semantics/mod-file.cpp @@ -8,6 +8,7 @@ #include "mod-file.h" #include "resolve-names.h" +#include "flang/Common/restorer.h" #include "flang/Evaluate/tools.h" #include "flang/Parser/message.h" #include "flang/Parser/parsing.h" @@ -99,6 +100,9 @@ }; bool ModFileWriter::WriteAll() { + // this flag affects character literals: force it to be consistent + auto restorer{ + common::ScopedSet(parser::useHexadecimalEscapeSequences, false)}; WriteAll(context_.globalScope()); return !context_.AnyFatalError(); }