zhaoyonggang via llvm-dev
2020-Sep-27 10:27 UTC
[llvm-dev] [clang-tidy] where are "clang-diagnostic" checkers
Hi, all, I build clang-tidy by "ninja clang-tidy", but when I run below command, I get no checks. Where is the clang-diagnostic* checkers? Thanks in advance.> $ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build-debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checksNo checks enabled.
zhaoyonggang via llvm-dev
2020-Sep-27 11:30 UTC
[llvm-dev] [clang-tidy] where are "clang-diagnostic" checkers
I have seen "clang-diagnostic-unreachable-code" when I use clang-tidy 7.0, is it removed from latest clang-tidy?> On Sep 27, 2020, at 6:27 PM, zhaoyonggang via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, all, > > I build clang-tidy by "ninja clang-tidy", but when I run below command, I get no checks. Where is the clang-diagnostic* checkers? Thanks in advance. > >> $ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build-debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checks > No checks enabled. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
zhaoyonggang via llvm-dev
2020-Sep-27 23:10 UTC
[llvm-dev] [clang-tidy] How to check this code
Hi, Everyone My problem is how to check below code. How to add custom check for below code ? Stmt(after(returnStmt))? Any clue is welcome, thanks FYI , I have noted such issue can be checked by "clang-diagnostic-unreachable-code" when I use clang-tidy 7(not so sure). But currently I want to develop custom checker, and I clone latest llvm repo and build clang-tidy. Clang-tidy I build can't find any issue. ```cpp int16_t with_unreach( int16_t para) { int16_t local = 0; int* pt = nullptr; int a = *pt; switch (para) { local = para; // unreachable code case 1:{ break; } default: { break; } } return para; para++; // unreachable code } ```> On Sep 27, 2020, at 7:30 PM, zhaoyonggang <yonggang.zhao at icloud.com> wrote: > > I have seen "clang-diagnostic-unreachable-code" when I use clang-tidy 7.0, is it removed from latest clang-tidy? > >> On Sep 27, 2020, at 6:27 PM, zhaoyonggang via llvm-dev <llvm-dev at lists.llvm.org> wrote: >> >> Hi, all, >> >> I build clang-tidy by "ninja clang-tidy", but when I run below command, I get no checks. Where is the clang-diagnostic* checkers? Thanks in advance. >> >>> $ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build-debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checks >> No checks enabled. >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200928/a0a12ab9/attachment.html>
Nathan James via llvm-dev
2020-Sep-29 22:17 UTC
[llvm-dev] [clang-tidy] where are "clang-diagnostic" checkers
Hi, clang-diagnostic* doesn't refer to a group of checkers, they refer to diagnostics emitted by clang during parsing and sema. If you want a full list of checks available you can run `clang-tidy --checks=* --list-checks` ~Nathan On Sun, 2020-09-27 at 18:27 +0800, zhaoyonggang via llvm-dev wrote:> Hi, all, > > I build clang-tidy by "ninja clang-tidy", but when I run below > command, I get no checks. Where is the clang-diagnostic* > checkers? Thanks in advance. > > > $ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build- > > debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checks > No checks enabled. > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
zhaoyonggang via llvm-dev
2020-Sep-30 01:16 UTC
[llvm-dev] [clang-tidy] where are "clang-diagnostic" checkers
Hi, Nathan Thanks a lot. When I modify below code, and clang-diagnostic-unreachable-code warning will be reported when I run `/Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build-debug/bin/clang-tidy --checks=* ../library.cpp`. I still need to find how to enable "unreachable code" warning by command option not by modifying code --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -612,7 +612,7 @@ def warn_suggest_noreturn_block : Warning< // Unreachable code. def warn_unreachable : Warning< "code will never be executed">, - InGroup<UnreachableCode>, DefaultIgnore; + InGroup<UnreachableCode>; def warn_unreachable_break : Warning< "'break' will never be executed">, InGroup<UnreachableCodeBreak>, DefaultIgnore;> On Sep 30, 2020, at 6:17 AM, Nathan James <n.james93 at hotmail.co.uk> wrote: > > Hi, > > clang-diagnostic* doesn't refer to a group of checkers, they refer to > diagnostics emitted by clang during parsing and sema. > > If you want a full list of checks available you can run > `clang-tidy --checks=* --list-checks` > > ~Nathan > On Sun, 2020-09-27 at 18:27 +0800, zhaoyonggang via llvm-dev wrote: >> Hi, all, >> >> I build clang-tidy by "ninja clang-tidy", but when I run below >> command, I get no checks. Where is the clang-diagnostic* >> checkers? Thanks in advance. >> >>> $ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build- >>> debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checks >> No checks enabled. >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >