Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / AST / ast-dump-concepts.cpp
blob06518a71987a2251f10ff27a6fafdefd326052e6
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: |-ImplicitConceptSpecializationDecl {{.*}} <line:13:9> col:9
23 // CHECK-NEXT: | |-TemplateArgument type 'type-parameter-1-0'
24 // CHECK-NEXT: | | `-TemplateTypeParmType {{.*}} 'type-parameter-1-0' dependent {{.*}}depth 1 index 0
25 // CHECK-NEXT: | `-TemplateArgument type 'int'
26 // CHECK-NEXT: | `-BuiltinType {{.*}} 'int'
27 // CHECK-NEXT: |-TemplateArgument {{.*}} type 'R'
28 // CHECK-NEXT: | `-TemplateTypeParmType {{.*}} 'R'
29 // CHECK-NEXT: | `-TemplateTypeParm {{.*}} 'R'
30 // CHECK-NEXT: `-TemplateArgument {{.*}} type 'int'
31 // CHECK-NEXT: `-BuiltinType {{.*}} 'int'
32 template <binary_concept<int> R>
33 Foo(R);
35 // CHECK: TemplateTypeParmDecl {{.*}} referenced Concept {{.*}} 'unary_concept'
36 // CHECK-NEXT: `-ConceptSpecializationExpr {{.*}} <col:13> 'bool'
37 // CHECK-NEXT: |-ImplicitConceptSpecializationDecl {{.*}} <line:10:9> col:9
38 // CHECK-NEXT: | `-TemplateArgument type 'type-parameter-1-0'
39 // CHECK-NEXT: | `-TemplateTypeParmType {{.*}} 'type-parameter-1-0' dependent {{.*}}depth 1 index 0
40 template <unary_concept R>
41 Foo(R);
43 // CHECK: FunctionTemplateDecl {{.*}} <line:[[@LINE+1]]:3, line:[[@LINE+2]]:39> {{.*}} Foo<T>
44 template <typename R>
45 Foo(R, int) requires unary_concept<R>;
47 // CHECK: FunctionTemplateDecl {{.*}} <line:[[@LINE+1]]:3, line:[[@LINE+3]]:3> {{.*}} Foo<T>
48 template <typename R>
49 Foo(R, char) requires unary_concept<R> {
52 // CHECK: CXXFoldExpr {{.*}} <col:13, col:29>
53 template <variadic_concept... Ts>
54 Foo();
56 // CHECK: CXXFoldExpr {{.*}} <col:13, col:34>
57 template <variadic_concept<int>... Ts>
58 Foo();