[PATCH] D156693: [clang][ASTImporter]Skip check depth of friend template parameter
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 06:16:53 PDT 2023
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
More information about the cfe-commits
mailing list