diff options
author | Haojian Wu <hokein@google.com> | 2019-09-03 14:13:00 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2019-09-03 14:13:00 +0000 |
commit | 67853ac4e01a60e9be3db0c1745c7bdc58dfa446 (patch) | |
tree | 285048dd9dcb4bbb20344941ddb2844de9ba0590 /clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp | |
parent | 97e5de522e6d09adabcfe5c6ac09a4f0c5b1c153 (diff) | |
download | bcm5719-llvm-67853ac4e01a60e9be3db0c1745c7bdc58dfa446.tar.gz bcm5719-llvm-67853ac4e01a60e9be3db0c1745c7bdc58dfa446.zip |
[clang-tidy] Fix a false positive in unused-using-decl check
The previous matcher "hasAnyTemplateArgument(templateArgument())" only
matches the first template argument, but the check wants to iterate all
template arguments. This patch fixes this.
Also some refactorings in this patch (to make the code reusable).
llvm-svn: 370760
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp b/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp index eed0baeb3eb..9511160bc2f 100644 --- a/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-unused-using-decls.cpp @@ -31,6 +31,8 @@ class N {}; template <int T> class P {}; const int Constant = 0; +template <typename T> class Q {}; + class Base { public: void f(); @@ -169,6 +171,8 @@ using n::N; using n::Constant; // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'Constant' is unused +using n::Q; + // ----- Usages ----- void f(B b); void g() { @@ -202,3 +206,8 @@ template void h(n::M<N>* t); template <int T> void i(n::P<T>* t) {} template void i(n::P<Constant>* t); + +template <typename T, template <typename> class U> class Bar {}; +// We used to report Q unsued, because we only checked the first template +// argument. +Bar<int, Q> *bar; |