llvm-project/clang/test
Aaron Ballman 881125ad91 Allow use of an elaborated type specifier in a _Generic association in C++
Currently, Clang accepts this code in C mode (where the tag is required
to be used) but rejects it in C++ mode thinking that the association is
defining a new type.

void foo(void) {
  struct S { int a; };
  _Generic(something, struct S : 1);
}
Clang thinks this in C++ because it sees struct S : when parsing the
class specifier and decides that must be a type definition (because the
colon signifies the presence of a base class type). This patch adds a
new declarator context to represent a _Generic association so that we
can distinguish these situations properly.

Fixes #55562

Differential Revision: https://reviews.llvm.org/D126969
2022-06-06 07:17:35 -04:00
..
APINotes
ARCMT [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
AST [AST] Dont invalidate a ref-type var decl if it has no initializer. 2022-05-25 15:14:35 +02:00
ASTMerge
Analysis [analyzer][NFC] Add test for 3a07280290 2022-06-01 18:53:19 +02:00
C/drs Correct the behavior of this test for non-Windows targets 2022-06-03 09:00:05 -04:00
CXX [NFC] Add test cases reported in PR54341 2022-06-05 20:34:28 +02:00
ClangScanDeps [Lex] Fix crash during dependency scanning while skipping an unmatched `#if` 2022-05-27 23:59:30 -07:00
CodeCompletion
CodeGen [Clang][FP16] Add 4 builtins for _Float16 2022-06-06 09:00:26 +08:00
CodeGenCUDA [IR] Enable opaque pointers by default 2022-06-02 09:40:56 +02:00
CodeGenCUDASPIRV [Driver][test] Remove unused/obsoleted REQUIRES: clang-driver 2022-04-12 13:29:46 -07:00
CodeGenCXX [PS5] Apply 'packed' attribute to base classes, matching PS4 ABI 2022-06-02 12:26:26 -07:00
CodeGenCoroutines [C++20] [Coroutines] Conform the updates for CWG issue 2585 2022-05-25 10:31:26 +08:00
CodeGenHIP [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
CodeGenHLSL [HLSL] Enable vector types for hlsl. 2022-05-31 13:54:17 -07:00
CodeGenObjC [FileCheck] Catch missspelled directives. 2022-05-26 11:37:19 +01:00
CodeGenObjCXX [DeadArgElim] Re-apply: Set unused arguments for internal functions 2022-05-12 08:46:16 -07:00
CodeGenOpenCL [AMDGPU] Add llvm.amdgcn.sched.barrier intrinsic 2022-05-11 13:22:51 -07:00
CodeGenOpenCLCXX [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
CodeGenSYCL [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
Coverage [OpaquePtrs][Clang] Add -no-opaque-pointers to tests (NFC) 2022-04-07 12:09:47 +02:00
CoverageMapping [clang][NFC] Cleanup some coroutine tests 2022-05-16 05:15:12 -07:00
Driver [Driver][test] Remove unneeded -no-canonical-prefixes and -o %t.o 2022-06-05 16:06:09 -07:00
ExtractAPI [clang][extract-api] Don't emit symbols prefixed with an underscore 2022-05-25 19:02:18 +01:00
FixIt Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
Format [clang-format] Allow empty .clang-format file 2022-04-12 21:20:54 -07:00
Frontend [Clang] Add DriverKit support 2022-05-13 20:34:57 +01:00
Headers Roll back use of #warning for header deprecations 2022-05-26 14:51:39 -04:00
Import [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
Index Revert "[clang][test] mark tests added in ee8524087c as unsupported on AIX" 2022-05-30 09:35:26 -04:00
Integration
InterfaceStubs
Interpreter Revert "[clang-repl] Recover the lookup tables of the primary context." 2022-05-31 06:25:37 +00:00
Layout
Lexer [Tooling/DependencyScanning & Preprocessor] Refactor dependency scanning to produce pre-lexed preprocessor directive tokens, instead of minimized sources 2022-05-26 12:50:06 -07:00
LibClang
Misc Support warn_unused_result on typedefs 2022-06-02 20:57:31 +00:00
Modules Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules" 2022-06-01 12:11:57 -07:00
OpenMP [Clang][OpenMP] Add the codegen support for `atomic compare capture` 2022-06-02 21:38:21 -04:00
PCH Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
Parser Improve the strict prototype diagnostic behavior 2022-05-26 08:35:56 -04:00
ParserHLSL [HLSL] Adjust access specifier behavior 2022-04-28 10:37:50 -05:00
ParserSYCL
Preprocessor [test] Modify test to verify D126396 (Clean "./" from __FILE__ expansion) 2022-06-03 17:54:03 -07:00
Profile [NFC] Rename Instrinsic to Intrinsic 2022-04-25 18:13:23 +01:00
Refactor
Rewriter [C11/C2x] Change the behavior of the implicit function declaration warning 2022-04-20 11:30:12 -04:00
Sema Allow use of an elaborated type specifier in a _Generic association in C++ 2022-06-06 07:17:35 -04:00
SemaCUDA Fix test; we now expect a pedantic warning 2022-05-11 06:52:21 -04:00
SemaCXX Allow use of an elaborated type specifier in a _Generic association in C++ 2022-06-06 07:17:35 -04:00
SemaHLSL [HLSL] Add WaveActiveCountBits as Langugage builtin function for HLSL 2022-06-02 13:06:01 -07:00
SemaObjC Revert "Drop qualifiers from return types in C (DR423)" 2022-06-02 08:28:43 -04:00
SemaObjCXX Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
SemaOpenCL [OpenCL] Do not guard vload/store_half builtins 2022-05-17 10:57:23 +01:00
SemaOpenCLCXX
SemaSYCL
SemaTemplate [clang] Prevent folding of non-const compound expr 2022-05-16 07:50:39 +02:00
TableGen
Templight
Tooling Change the behavior of implicit int diagnostics 2022-05-04 08:35:47 -04:00
Unit [lit] Fix setup of sanitizer environment 2022-05-19 19:24:16 -07:00
VFS Reland "[dwarf] Emit a DIGlobalVariable for constant strings." 2022-05-18 13:56:45 -07:00
clang-rename
utils/update_cc_test_checks Revert "[utils] Avoid hardcoding metadata ids in update_cc_test_checks" 2022-05-10 14:04:19 -07:00
.clang-format
CMakeLists.txt [clang-fuzzer] Add a tiny tool to generate a fuzzing dictionary for clang 2022-05-09 18:25:29 +02:00
TestRunner.sh
lit.cfg.py [lit] Fix setup of sanitizer environment 2022-05-19 19:24:16 -07:00
lit.site.cfg.py.in [Driver] Change CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL to affect driver default instead of cc1 default 2022-04-13 16:58:00 -07:00