[clang] [clang-repl] Ensure clang-repl accepts all C keywords supported in all language models (PR #142749)
Anutosh Bhat via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 4 02:15:32 PDT 2025
https://github.com/anutosh491 created https://github.com/llvm/llvm-project/pull/142749
As can be seen through the docs (https://github.com/llvm/llvm-project/blob/7e1fa09ce2a228c949ce4490c98f2c73ed8ada00/clang/docs/LanguageExtensions.rst#c-keywords-supported-in-all-language-modes), Clang supports certain C keywords in all language modes — this patch ensures clang-repl handles them consistently.
Here's an example testing all the above keywords. We have everything in place except `_Imaginary` (_Complex works but _Imaginary doesn't which was weird) and `_Noreturn`
>From be0d72e8dab1ef90771e5929dcd5064e5980f877 Mon Sep 17 00:00:00 2001
From: anutosh491 <andersonbhat491 at gmail.com>
Date: Wed, 4 Jun 2025 14:34:05 +0530
Subject: [PATCH] Ensure clang-repl accepts all C keywords supported in all
Clang language modes
---
clang/lib/Parse/ParseTentative.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 95cee824c40b7..f50bcd8ea90bb 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1171,6 +1171,7 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename,
case tok::kw_inline:
case tok::kw_virtual:
case tok::kw_explicit:
+ case tok::kw__Noreturn:
// Modules
case tok::kw___module_private__:
@@ -1225,6 +1226,7 @@ Parser::isCXXDeclarationSpecifier(ImplicitTypenameContext AllowImplicitTypename,
// GNU
case tok::kw_restrict:
case tok::kw__Complex:
+ case tok::kw__Imaginary:
case tok::kw___attribute:
case tok::kw___auto_type:
return TPResult::True;
More information about the cfe-commits
mailing list