[PATCH] D148158: [include-cleaner] Handle incomplete template specializations
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 13 03:49:05 PDT 2023
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:85
// This is the underlying decl used by TemplateSpecializationType, can be
// null when type is dependent if so fallback to primary template.
CXXRecordDecl *TD = TST->getAsCXXRecordDecl();
----------------
update comment - dependent or not resolved to a pattern yet?
================
Comment at: clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp:163
ElementsAre(Decl::ClassTemplatePartialSpecialization));
+ // Incomplete templates don't have a specific specialization associated.
+ EXPECT_THAT(testWalk(R"cpp(
----------------
There's no incomplete template here (did you mean `template <typename struct Foo;` or `template <typename T> struct Foo<T*>;`?)
If it's enough that the template is never instantiated then maybe it's still clearer not to provide a definition (and tweak the comment slightly?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148158/new/
https://reviews.llvm.org/D148158
More information about the cfe-commits
mailing list