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

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Tue Jan 16 10:51:36 PST 2024


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

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

>From 58ef92f2351dd5ca0598acd6fea029d3e6f2cdaf Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Tue, 16 Jan 2024 10:48:40 -0800
Subject: [PATCH] [flang] Don't use \uXXXX encodings unless \-escapes are
 enabled

Don't put \uXXXX escapes into the cooked character stream while
prescanning; it should always be UTF-8.
---
 flang/include/flang/Parser/characters.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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) {



More information about the flang-commits mailing list