Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.friend / p7-cxx20.cpp
blob054e6fb3e076eadf93f71ca2019893e878b93440
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 // RUN: cd %t
5 //
6 // RUN: %clang_cc1 -std=c++20 no-modules.cpp -fsyntax-only -ast-dump | \
7 // RUN: FileCheck --match-full-lines --check-prefix=CHECK-NM %s
8 // RUN: %clang_cc1 -std=c++20 -xc++-user-header header-unit.h -ast-dump | \
9 // RUN: FileCheck --match-full-lines --check-prefix=CHECK-HU %s
10 // RUN: %clang_cc1 -std=c++20 module.cpp -ast-dump | \
11 // RUN: FileCheck --match-full-lines --check-prefix=CHECK-MOD %s
13 //--- no-modules.cpp
15 class X {
16 friend void x(){};
19 // CHECK-NM: `-CXXRecordDecl {{.*}} <no-modules.cpp:2:1, line:4:1> line:2:7 class X definition
20 // CHECK-NM: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class X
21 // CHECK-NM-NEXT: `-FriendDecl {{.*}} <line:3:3, col:19> col:15
22 // CHECK-NM-NEXT: `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 friend_undeclared x 'void ()' implicit-inline
24 //--- header-unit.h
26 class Y {
27 friend void y(){};
30 // CHECK-HU: `-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header-unit.h:2:1, line:4:1> line:2:7 class Y definition
31 // CHECK-HU: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 implicit class Y
32 // CHECK-HU-NEXT: `-FriendDecl {{.*}} <line:3:3, col:19> col:15
33 // CHECK-HU-NEXT: `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 friend_undeclared y 'void ()' implicit-inline
35 // A textually-included header
36 //--- header.h
38 class A {
39 friend void a(){};
42 //--- module.cpp
43 module;
44 #include "header.h"
46 export module M;
48 class Z {
49 friend void z(){};
51 // CHECK-MOD: |-CXXRecordDecl {{.*}} <.{{/|\\\\?}}header.h:2:1, line:4:1> line:2:7 in M.<global> hidden class A definition
52 // CHECK-MOD: | |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M.<global> hidden implicit class A
53 // CHECK-MOD-NEXT: | `-FriendDecl {{.*}} <line:3:3, col:19> col:15 in M.<global>
54 // CHECK-MOD-NEXT: | `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 in M.<global> hidden friend_undeclared a 'void ()' implicit-inline
56 // CHECK-MOD: `-CXXRecordDecl {{.*}} <module.cpp:6:1, line:8:1> line:6:7 in M hidden class Z{{( ReachableWhenImported)?}} definition
57 // CHECK-MOD: |-CXXRecordDecl {{.*}} <col:1, col:7> col:7 in M hidden implicit class Z{{( ReachableWhenImported)?}}
58 // CHECK-MOD-NEXT: `-FriendDecl {{.*}} <line:7:3, col:19> col:15 in M{{( ReachableWhenImported)?}}
59 // CHECK-MOD-NEXT: `-FunctionDecl {{.*}} parent {{.*}} <col:3, col:19> col:15 in M hidden friend_undeclared z 'void ()'{{( ReachableWhenImported)?}}