forked from OSchip/llvm-project
Handle FriendDecl in DeclContextPrinter
This commit fixes a crash that occurs when -print-decl-contexts AST consumer tries to print an unhandled declaration. rdar://19467234 Differential Revision: https://reviews.llvm.org/D26964 llvm-svn: 290880
This commit is contained in:
parent
847fda1419
commit
14abc7f007
|
@ -478,6 +478,13 @@ void DeclContextPrinter::PrintDeclContext(const DeclContext* DC,
|
|||
Out << "<omp threadprivate> " << '"' << I << "\"\n";
|
||||
break;
|
||||
}
|
||||
case Decl::Friend: {
|
||||
Out << "<friend>";
|
||||
if (const NamedDecl *ND = cast<FriendDecl>(I)->getFriendDecl())
|
||||
Out << ' ' << *ND;
|
||||
Out << "\n";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Out << "DeclKind: " << DK << '"' << I << "\"\n";
|
||||
llvm_unreachable("decl unhandled");
|
||||
|
|
|
@ -25,3 +25,11 @@ enum E1 { EC1 };
|
|||
template <E1 v> class C1 {};
|
||||
template <E1 v> C1<v> f1() { return C1<v>(); }
|
||||
void f2() { f1<EC1>(); }
|
||||
|
||||
// Friend declarations
|
||||
struct FriendlyStruct {
|
||||
friend bool operator==(FriendlyStruct, FriendlyStruct) { return true; }
|
||||
friend struct FriendedStruct;
|
||||
};
|
||||
|
||||
struct FriendedStruct { };
|
||||
|
|
Loading…
Reference in New Issue