aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Lexer
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2023-06-05 11:03:14 -0400
committerAaron Ballman <aaron@aaronballman.com>2023-06-05 11:09:58 -0400
commit12728e144994efe84715f4e5dbb8c3104e9f0b5a (patch)
treec5ca684a78cb019078c3720503f24e608ceb462c /clang/test/Lexer
parentc9998ec145972714d581e19fd1c9cb276b836387 (diff)
downloadllvm-12728e144994efe84715f4e5dbb8c3104e9f0b5a.zip
llvm-12728e144994efe84715f4e5dbb8c3104e9f0b5a.tar.gz
llvm-12728e144994efe84715f4e5dbb8c3104e9f0b5a.tar.bz2
[C] Support _Generic expressions with a type operand
_Generic accepts an expression operand whose type is matched against a list of associations. The expression operand is unevaluated, but the type matched is the type after lvalue conversion. This conversion loses type information, which makes it more difficult to match against qualified or incomplete types. This extension allows _Generic to accept a type operand instead of an expression operand. The type operand form does not undergo any conversions and is matched directly against the association list. This extension is also supported in C++ as we already supported _Generic selection expressions there. The RFC for this extension can be found at: https://discourse.llvm.org/t/rfc-generic-selection-expression-with-a-type-operand/70388 Differential Revision: https://reviews.llvm.org/D149904
Diffstat (limited to 'clang/test/Lexer')
-rw-r--r--clang/test/Lexer/has_extension.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Lexer/has_extension.c b/clang/test/Lexer/has_extension.c
index b7efece..e54c16c 100644
--- a/clang/test/Lexer/has_extension.c
+++ b/clang/test/Lexer/has_extension.c
@@ -20,6 +20,14 @@ int has_c_static_assert();
int no_c_static_assert();
#endif
+// CHECK-PED-NONE: has_c_generic_selections_with_controlling_type
+// CHECK-PED-ERR: no_c_generic_selections_with_controlling_type
+#if __has_extension(c_generic_selection_with_controlling_type)
+int has_c_generic_selections_with_controlling_type();
+#else
+int no_c_generic_selections_with_controlling_type();
+#endif
+
// CHECK-PED-NONE: has_c_generic_selections
// CHECK-PED-ERR: no_c_generic_selections
#if __has_extension(c_generic_selections)