balazske added a comment. A simple test should be added to StructuralEquivalenceTest.cpp too to check if ignore (and not ignore) depth works.
I think this solution is not always correct, but is still an improvement. ================ Comment at: clang/include/clang/AST/ASTStructuralEquivalence.h:80 + bool Complain = true, bool ErrorOnTagTypeMismatch = false, + bool IgnoreDepth = false) : FromCtx(FromCtx), ToCtx(ToCtx), NonEquivalentDecls(NonEquivalentDecls), ---------------- bool IgnoreTemplateParmDepth = false) ================ Comment at: clang/lib/AST/ASTImporter.cpp:511 + bool IsStructuralMatch(Decl *From, Decl *To, bool Complain = true, + bool IgnoreDepth = true); ExpectedDecl VisitDecl(Decl *D); ---------------- This should be `false` to have the original behavior if not specified. ================ Comment at: clang/lib/AST/ASTImporter.cpp:5831 + FoundTemplate->getFriendObjectKind() != Decl::FOK_None && + !D->specializations().empty(); + if (IsStructuralMatch(D, FoundTemplate, true, IgnoreDepth)) { ---------------- Probably add `IsFriendTemplate`? ================ Comment at: clang/unittests/AST/ASTImporterTest.cpp:4258 + auto *FromA = FirstDeclMatcher<ClassTemplateDecl>().match( + FromTU, classTemplateDecl(hasName("A"))); + auto *ToA = Import(FromA, Lang_CXX11); ---------------- Probably add `hasDefinition()` to the matcher. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156693/new/ https://reviews.llvm.org/D156693 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits