https://github.com/cor3ntin updated 
https://github.com/llvm/llvm-project/pull/138716

>From cb8c80432affae6182e995a546c941b3b6afb8b0 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinja...@gmail.com>
Date: Tue, 6 May 2025 18:18:06 +0200
Subject: [PATCH 1/2] [Clang] Ignore -fchar8_t in C

In C, char8_t is an alias to unsigned char, and should
never be a keyword.

Fixes #55373
---
 clang/docs/ReleaseNotes.rst           | 2 ++
 clang/include/clang/Driver/Options.td | 3 ++-
 clang/test/Lexer/char8_t.cpp          | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 203958dab7430..2839ad81a8149 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -317,6 +317,8 @@ Modified Compiler Flags
 
 - The ``-mexecute-only`` and ``-mpure-code`` flags are now accepted for 
AArch64 targets. (#GH125688)
 
+- The ``-fchar8_t`` flag is no longer consider in non-C++ languages modes. 
(#GH55373)
+
 Removed Compiler Flags
 -------------------------
 
diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 11677626dbf1f..d55d15750f443 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3879,7 +3879,8 @@ defm char8__t : BoolFOption<"char8_t",
   LangOpts<"Char8">, Default<cpp20.KeyPath>,
   PosFlag<SetTrue, [], [ClangOption], "Enable">,
   NegFlag<SetFalse, [], [ClangOption], "Disable">,
-  BothFlags<[], [ClangOption, CC1Option], " C++ builtin type char8_t">>;
+  BothFlags<[], [ClangOption, CC1Option], " C++ builtin type char8_t">>,
+  ShouldParseIf<cplusplus.KeyPath>;
 def fshort_wchar : Flag<["-"], "fshort-wchar">, Group<f_Group>,
   HelpText<"Force wchar_t to be a short unsigned int">;
 def fno_short_wchar : Flag<["-"], "fno-short-wchar">, Group<f_Group>,
diff --git a/clang/test/Lexer/char8_t.cpp b/clang/test/Lexer/char8_t.cpp
index d65597c68d8bc..2148609155186 100644
--- a/clang/test/Lexer/char8_t.cpp
+++ b/clang/test/Lexer/char8_t.cpp
@@ -5,6 +5,7 @@
 // RUN: %clang_cc1 -std=c++17 -verify %s
 // RUN: %clang_cc1 -std=c++17 -verify %s -fno-char8_t
 // RUN: %clang_cc1 -std=c++20 -verify %s -fno-char8_t
+// RUN: %clang_cc1 -x c -verify %s -fchar8_t
 
 #if defined(__cpp_char8_t) != defined(CHAR8_T)
 #error wrong setting for __cpp_char_t

>From 85367486d6a2089092e216537c1b86ef75a29221 Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinja...@gmail.com>
Date: Tue, 6 May 2025 23:06:09 +0200
Subject: [PATCH 2/2] typo

---
 clang/docs/ReleaseNotes.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 2839ad81a8149..1621b6d4c3d93 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -317,7 +317,7 @@ Modified Compiler Flags
 
 - The ``-mexecute-only`` and ``-mpure-code`` flags are now accepted for 
AArch64 targets. (#GH125688)
 
-- The ``-fchar8_t`` flag is no longer consider in non-C++ languages modes. 
(#GH55373)
+- The ``-fchar8_t`` flag is no longer considered in non-C++ languages modes. 
(#GH55373)
 
 Removed Compiler Flags
 -------------------------

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to