[clang] [clang-repl] Ensure clang-repl accepts all C keywords supported in all language models (PR #142749)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 4 02:16:05 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Anutosh Bhat (anutosh491)
<details>
<summary>Changes</summary>
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`
---
Full diff: https://github.com/llvm/llvm-project/pull/142749.diff
1 Files Affected:
- (modified) clang/lib/Parse/ParseTentative.cpp (+2)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/142749
More information about the cfe-commits
mailing list