This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Handle incomplete template specializations
ClosedPublic

Authored by kadircet on Apr 12 2023, 12:55 PM.

Details

Summary

Instantiation pattern is null for incomplete template types and using
specializaiton decl results in not seeing re-declarations.

Diff Detail

Event Timeline

kadircet created this revision.Apr 12 2023, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2023, 12:55 PM
kadircet requested review of this revision.Apr 12 2023, 12:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2023, 12:55 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
sammccall accepted this revision.Apr 13 2023, 3:49 AM
sammccall added inline comments.
clang-tools-extra/include-cleaner/lib/WalkAST.cpp
85–86

update comment - dependent or not resolved to a pattern yet?

clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
163

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?)

This revision is now accepted and ready to land.Apr 13 2023, 3:49 AM
kadircet updated this revision to Diff 513173.Apr 13 2023, 4:37 AM
kadircet marked 2 inline comments as done.
  • Update comments & test
clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp
163

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?)

right, i meant the instantiation being "incomplete", not the template-decl itself. dropping the definition and updating the comment

This revision was landed with ongoing or failed builds.Apr 13 2023, 4:38 AM
This revision was automatically updated to reflect the committed changes.