[flang-commits] [flang] [flang] Don't use \uXXXX encodings unless \-escapes are enabled (PR #78326)

via flang-commits flang-commits at lists.llvm.org
Tue Jan 16 10:52:05 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-parser

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

Don't put \uXXXX escapes into the cooked character stream while prescanning; it should always be UTF-8.

---
Full diff: https://github.com/llvm/llvm-project/pull/78326.diff


1 Files Affected:

- (modified) flang/include/flang/Parser/characters.h (+1-1) 


``````````diff
diff --git a/flang/include/flang/Parser/characters.h b/flang/include/flang/Parser/characters.h
index dae0d3e2a0cfff..df188d674b9eeb 100644
--- a/flang/include/flang/Parser/characters.h
+++ b/flang/include/flang/Parser/characters.h
@@ -237,7 +237,7 @@ void EmitQuotedChar(char32_t ch, const NORMAL &emit, const INSERTED &insert,
   }};
   if (ch <= 0x7f) {
     emitOneByte(ch);
-  } else if (useHexadecimalEscapeSequences) {
+  } else if (backslashEscapes && useHexadecimalEscapeSequences) {
     insert('\\');
     insert('u');
     if (ch > 0xffff) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/78326


More information about the flang-commits mailing list