mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
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:
parent
6d8a23d9c8
commit
6f691d73b1
@ -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
|
||||
|
18
tools/clang-tidy/test/misc-unused-alias-decls.cpp
Normal file
18
tools/clang-tidy/test/misc-unused-alias-decls.cpp
Normal 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;
|
||||
}
|
1
tools/clang-tidy/test/misc-unused-alias-decls.json
Normal file
1
tools/clang-tidy/test/misc-unused-alias-decls.json
Normal 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\"]]"
|
Loading…
Reference in New Issue
Block a user