[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / ast-dump-concepts.cpp
blobdff300a559517bc58c20e0b81dc24ba8eab95275
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -std=c++2a -ast-dump -ast-dump-filter Foo %s | FileCheck -strict-whitespace %s
3 // Test with serialization:
4 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-unknown -emit-pch -o %t %s
5 // RUN: %clang_cc1 -x c++ -std=c++20 -triple x86_64-unknown-unknown -include-pch %t \
6 // RUN: -ast-dump-all -ast-dump-filter Foo /dev/null \
7 // RUN: | FileCheck --strict-whitespace %s
9 template <typename T>
10 concept unary_concept = true;
12 template <typename T, typename U>
13 concept binary_concept = true;
15 template <typename... Ts>
16 concept variadic_concept = true;
18 template <typename T>
19 struct Foo {
20 // CHECK: TemplateTypeParmDecl {{.*}} referenced Concept {{.*}} 'binary_concept'
21 // CHECK-NEXT: `-ConceptSpecializationExpr {{.*}} <col:13, col:31> 'bool' Concept {{.*}} 'binary_concept'
22 // CHECK-NEXT: |-TemplateArgument {{.*}} type 'R'
23 // CHECK-NEXT: | `-TemplateTypeParmType {{.*}} 'R'
24 // CHECK-NEXT: | `-TemplateTypeParm {{.*}} 'R'
25 // CHECK-NEXT: `-TemplateArgument {{.*}} type 'int'
26 // CHECK-NEXT: `-BuiltinType {{.*}} 'int'
27 template <binary_concept<int> R>
28 Foo(R);
30 // CHECK: TemplateTypeParmDecl {{.*}} referenced Concept {{.*}} 'unary_concept'
31 // CHECK-NEXT: `-ConceptSpecializationExpr {{.*}} <col:13> 'bool'
32 template <unary_concept R>
33 Foo(R);
35 // CHECK: FunctionTemplateDecl {{.*}} <line:[[@LINE+1]]:3, line:[[@LINE+2]]:39> {{.*}} Foo<T>
36 template <typename R>
37 Foo(R, int) requires unary_concept<R>;
39 // CHECK: FunctionTemplateDecl {{.*}} <line:[[@LINE+1]]:3, line:[[@LINE+3]]:3> {{.*}} Foo<T>
40 template <typename R>
41 Foo(R, char) requires unary_concept<R> {
44 // CHECK: CXXFoldExpr {{.*}} <col:13, col:29>
45 template <variadic_concept... Ts>
46 Foo();
48 // CHECK: CXXFoldExpr {{.*}} <col:13, col:34>
49 template <variadic_concept<int>... Ts>
50 Foo();