Bug 1475882 - clang-tidy: Enable misc-unused-alias-decls check. r=andi

This check finds unused namespace alias declarations. There are currently no misc-unused-alias-decls warnings in mozilla-central!

https://clang.llvm.org/extra/clang-tidy/checks/misc-unused-alias-decls.html

MozReview-Commit-ID: LHziGESvaM5

--HG--
extra : rebase_source : f10fbb6364bc947b5fa2ca8c0b47494519856940
extra : source : 987ca732290093c4bd36690c6ebd3ed2ac0b5444
This commit is contained in:
Chris Peterson 2018-07-09 11:04:31 -07:00
parent 6d8a23d9c8
commit 6f691d73b1
3 changed files with 21 additions and 0 deletions

View File

@ -52,6 +52,8 @@ clang_checkers:
publish: !!bool yes
- name: misc-swapped-arguments
publish: !!bool yes
- name: misc-unused-alias-decls
publish: !!bool yes
- name: misc-unused-raii
publish: !!bool yes
- name: misc-unused-using-decls

View File

@ -0,0 +1,18 @@
// https://clang.llvm.org/extra/clang-tidy/checks/misc-unused-alias-decls.html
namespace n1 {
namespace n2 {
namespace n3 {
int qux = 42;
}
}
}
namespace n1_unused = ::n1; // WARNING
namespace n12_unused = n1::n2; // WARNING
namespace n123 = n1::n2::n3; // OK
int test()
{
return n123::qux;
}

View File

@ -0,0 +1 @@
"[[\"warning\", \"namespace alias decl 'n1_unused' is unused\", \"misc-unused-alias-decls\"], [\"warning\", \"namespace alias decl 'n12_unused' is unused\", \"misc-unused-alias-decls\"]]"