[all-commits] [llvm/llvm-project] 100ffb: [include-cleaner] Report all specializations if th...

Haojian Wu via All-commits all-commits at lists.llvm.org
Wed Jun 7 01:59:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 100ffbf991e78bb3e94a9d5c8d656a9b8648082d
      https://github.com/llvm/llvm-project/commit/100ffbf991e78bb3e94a9d5c8d656a9b8648082d
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2023-06-07 (Wed, 07 Jun 2023)

  Changed paths:
    M clang-tools-extra/include-cleaner/lib/WalkAST.cpp
    M clang-tools-extra/include-cleaner/unittests/WalkASTTest.cpp

  Log Message:
  -----------
  [include-cleaner] Report all specializations if the primary template is introduced by a using-decl.

This will fix unused-include false positive.

```
// primary.h
namespace ns {
template<class T1, class T2> class Z {}; // primary template
}

// partial.h
namespace ns {
template<class T> class Z<T, T*> {};     // partial specialization
}

// main.cpp

using ns::Z; // refs to the primary
void k() {
  Z<int, int*> z; // use the partial specialization
}
```

Differential Revision: https://reviews.llvm.org/D152345




More information about the All-commits mailing list