Character literals can be formatted using octal or hex escapes for
non-ascii characters. This is so that the program can be unparsed for
either pgf90 or gfortran to compile. But modfiles should not be affected
by that -- they should be consistent.
This changes causes modfiles to always have character literals formatted
with octal escapes.
Differential Revision: https://reviews.llvm.org/D83703
#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"
};
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();
}
class ModFileWriter {
public:
- ModFileWriter(SemanticsContext &context) : context_{context} {}
+ explicit ModFileWriter(SemanticsContext &context) : context_{context} {}
bool WriteAll();
private: