kadircet accepted this revision. kadircet added a comment. This revision is now accepted and ready to land.
thanks! ================ Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:176 + void reportSpecializations(SourceLocation Loc, NamedDecl *ND) { + if (const auto *TD = dyn_cast<TemplateDeclType>(ND)) { + for (auto *Spec : TD->specializations()) ---------------- nit: prefer early exit ================ Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:176 + void reportSpecializations(SourceLocation Loc, NamedDecl *ND) { + if (const auto *TD = dyn_cast<TemplateDeclType>(ND)) { + for (auto *Spec : TD->specializations()) ---------------- kadircet wrote: > nit: prefer early exit s/dyn_cast/llvm::dyn_cast ================ Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:179 + report(Loc, Spec, RefType::Ambiguous); + SmallVector<ParitialDeclType *> PartialSpecializations; + TD->getPartialSpecializations(PartialSpecializations); ---------------- s/SmallVector/llvm::SmallVector ================ Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:202 + UD->getLocation(), TD); + if (const auto *FTD = dyn_cast<FunctionTemplateDecl>(TD)) + for (auto *Spec : FTD->specializations()) ---------------- s/dyn_cast/llvm::dyn_cast ================ Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:257-272 + testWalk(R"cpp( +namespace ns { +template<class T1, class T2> class $ambiguous^Z {}; // primary template +template<class T> class $ambiguous^Z<T, T*> {}; // partial specialization +template<class T> class $ambiguous^Z<T, T&> {}; // partial specialization +} + )cpp", ---------------- i think we can merge these into a single test with something like: ``` namespace ns { template <typename T> struct Z {}; template <typename T> struct Z<T*> {}; template <> struct Z<int> {}; } using ns::Z; // uses all 3. ``` same applies to var template tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152345/new/ https://reviews.llvm.org/D152345 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits