diff --git a/clang/lib/AST/TextNodeDumper.cpp b/clang/lib/AST/TextNodeDumper.cpp --- a/clang/lib/AST/TextNodeDumper.cpp +++ b/clang/lib/AST/TextNodeDumper.cpp @@ -300,6 +300,17 @@ } } + switch (D->getFriendObjectKind()) { + case Decl::FOK_None: + break; + case Decl::FOK_Declared: + OS << " friend"; + break; + case Decl::FOK_Undeclared: + OS << " friend_undeclared"; + break; + } + ConstDeclVisitor::Visit(D); } diff --git a/clang/test/AST/ast-dump-decl.cpp b/clang/test/AST/ast-dump-decl.cpp --- a/clang/test/AST/ast-dump-decl.cpp +++ b/clang/test/AST/ast-dump-decl.cpp @@ -525,7 +525,7 @@ // CHECK-NEXT: | | `-Destructor simple irrelevant trivial needs_implicit{{$}} // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} col:31 implicit class TestClassTemplate{{$}} // CHECK-NEXT: | `-FriendDecl 0x{{.+}} col:40{{$}} - // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} col:40 TestClassTemplate{{$}} + // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} col:40 friend_undeclared TestClassTemplate{{$}} // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:23 typename depth 1 index 0 T2{{$}} // CHECK-NEXT: | `-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} col:40 class TestClassTemplate{{$}} // CHECK-NEXT: `-ClassTemplateSpecializationDecl 0x{{.+}} line:[[@LINE-19]]:31 class TestClassTemplate definition implicit_instantiation{{$}} @@ -541,7 +541,7 @@ // CHECK-NEXT: | `-CXXRecord 0x{{.+}} 'A'{{$}} // CHECK-NEXT: |-CXXRecordDecl 0x{{.+}} col:31 implicit class TestClassTemplate{{$}} // CHECK-NEXT: |-FriendDecl 0x{{.+}} col:40{{$}} - // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:40 TestClassTemplate{{$}} + // CHECK-NEXT: | `-ClassTemplateDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:40 friend TestClassTemplate{{$}} // CHECK-NEXT: | |-TemplateTypeParmDecl 0x{{.+}} col:23 typename depth 0 index 0 T2{{$}} // CHECK-NEXT: | |-CXXRecordDecl 0x{{.+}} parent 0x{{.+}} prev 0x{{.+}} col:40 class TestClassTemplate{{$}} // CHECK-NEXT: | `-ClassTemplateSpecialization 0x{{.+}} 'TestClassTemplate'{{$}} diff --git a/clang/test/CXX/class/class.friend/p7-cxx20.cpp b/clang/test/CXX/class/class.friend/p7-cxx20.cpp --- a/clang/test/CXX/class/class.friend/p7-cxx20.cpp +++ b/clang/test/CXX/class/class.friend/p7-cxx20.cpp @@ -19,7 +19,7 @@ // CHECK-NM: `-CXXRecordDecl {{.*}} line:2:7 class X definition // CHECK-NM: |-CXXRecordDecl {{.*}} col:7 implicit class X // CHECK-NM-NEXT: `-FriendDecl {{.*}} col:15 -// CHECK-NM-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 x 'void ()' implicit-inline +// CHECK-NM-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 friend_undeclared x 'void ()' implicit-inline //--- header-unit.h @@ -30,7 +30,7 @@ // CHECK-HU: `-CXXRecordDecl {{.*}} <./header-unit.h:2:1, line:4:1> line:2:7 class Y definition // CHECK-HU: |-CXXRecordDecl {{.*}} col:7 implicit class Y // CHECK-HU-NEXT: `-FriendDecl {{.*}} col:15 -// CHECK-HU-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 y 'void ()' implicit-inline +// CHECK-HU-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 friend_undeclared y 'void ()' implicit-inline // A textually-included header //--- header.h @@ -51,9 +51,9 @@ // CHECK-MOD: |-CXXRecordDecl {{.*}} <./header.h:2:1, line:4:1> line:2:7 in M. hidden class A definition // CHECK-MOD: | |-CXXRecordDecl {{.*}} col:7 in M. hidden implicit class A // CHECK-MOD-NEXT: | `-FriendDecl {{.*}} col:15 in M. -// CHECK-MOD-NEXT: | `-FunctionDecl {{.*}} parent {{.*}} col:15 in M. hidden a 'void ()' implicit-inline +// CHECK-MOD-NEXT: | `-FunctionDecl {{.*}} parent {{.*}} col:15 in M. hidden friend_undeclared a 'void ()' implicit-inline // CHECK-MOD: `-CXXRecordDecl {{.*}} line:6:7 in M hidden class Z{{( ReachableWhenImported)?}} definition // CHECK-MOD: |-CXXRecordDecl {{.*}} col:7 in M hidden implicit class Z{{( ReachableWhenImported)?}} // CHECK-MOD-NEXT: `-FriendDecl {{.*}} col:15 in M{{( ReachableWhenImported)?}} -// CHECK-MOD-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 in M hidden z 'void ()'{{( ReachableWhenImported)?}} +// CHECK-MOD-NEXT: `-FunctionDecl {{.*}} parent {{.*}} col:15 in M hidden friend_undeclared z 'void ()'{{( ReachableWhenImported)?}}