[PATCH] D83703: [flang] Use octal escapes for character literals in modfiles

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 13 12:06:46 PDT 2020


tskeith updated this revision to Diff 277522.
tskeith added a comment.
Herald added a reviewer: sscalpone.

Use common::ScopedSet instead of explicit destructor.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83703/new/

https://reviews.llvm.org/D83703

Files:
  flang/lib/Semantics/mod-file.cpp
  flang/lib/Semantics/mod-file.h


Index: flang/lib/Semantics/mod-file.h
===================================================================
--- flang/lib/Semantics/mod-file.h
+++ 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:
Index: flang/lib/Semantics/mod-file.cpp
===================================================================
--- flang/lib/Semantics/mod-file.cpp
+++ 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();
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83703.277522.patch
Type: text/x-patch
Size: 1092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200713/838a9e83/attachment.bin>


More information about the llvm-commits mailing list