[llvm-dev] [clang-tidy] where are "clang-diagnostic" checkers

zhaoyonggang via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 29 18:16:53 PDT 2020


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
> 



More information about the llvm-dev mailing list