Skip to content

release/20.x: [clang-repl] Ensure clang-repl accepts all C keywords supported in all language models (#142749) #142909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: release/20.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/lib/Parse/ParseTentative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,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__:
Expand Down Expand Up @@ -1558,6 +1559,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;
Expand Down
13 changes: 13 additions & 0 deletions clang/test/Interpreter/disambiguate-decl-stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,16 @@ __attribute((noreturn)) Attrs2::Attrs2() = default;

// Extra semicolon
namespace N {};

// Test C keywords supported in all language modes.
// https://clang.llvm.org/docs/LanguageExtensions.html#c-keywords-supported-in-all-language-modes

_Alignas(16) int aligned_var;
int align = _Alignof(double);
_Atomic int atomic_var = 0;
_Complex double complex_val = 1.0 + 2.0i;
_Float16 f = 1.5;
_Thread_local int counter = 0;
_Static_assert(sizeof(int) == 4, "int must be 4 bytes");
_Imaginary float i = 2.0f; // expected-error {{imaginary types are not supported}}
_Noreturn void noreturn_func() { while (true) {} }
Loading