<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi, Everyone<div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>My problem is how to check below code. How to add custom check for below code ? Stmt(after(returnStmt))? Any clue is welcome, thanks</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span></div><div class=""><br class=""></div><div class="">```cpp</div><div class=""><pre style="background-color: rgb(255, 255, 255); font-family: "JetBrains Mono", monospace; font-size: 9.8pt;" class=""><span style="color:#371f80;" class="">int16_t </span>with_unreach( <span style="color:#371f80;" class="">int16_t </span>para) {<br class=""> <span style="color:#371f80;" class="">int16_t </span>local = <span style="color:#0000ff;" class="">0</span>;<br class=""><br class=""> <span style="color:#000080;font-weight:bold;" class="">int</span>* pt = <span style="color:#000080;font-weight:bold;" class="">nullptr</span>;<br class=""> <span style="color:#000080;font-weight:bold;" class="">int </span>a = *pt;<br class=""> <span style="color:#000080;font-weight:bold;" class="">switch </span>(para) {<br class=""> local = para;<br class=""> // unreachable code</pre><pre style="background-color: rgb(255, 255, 255); font-family: "JetBrains Mono", monospace; font-size: 9.8pt;" class=""><span style="color:#808080;font-style:italic;" class=""> </span><span style="color:#000080;font-weight:bold;" class="">case </span><span style="color:#0000ff;" class="">1</span>:{<br class=""> <span style="color:#000080;font-weight:bold;" class="">break</span>;<br class=""> }<br class=""><br class=""> <span style="color:#000080;font-weight:bold;" class="">default</span>: {<br class=""> <span style="color:#000080;font-weight:bold;" class="">break</span>;<br class=""> }<br class=""> }<br class=""> <span style="color:#000080;font-weight:bold;" class="">return </span>para;<br class=""> para++;<br class=""> <span style="color:#808080;font-style:italic;" class="">// unreachable code<br class=""></span><span style="color:#808080;font-style:italic;" class=""><br class=""></span>}</pre><div class=""><br class=""></div></div><div class=""><br class=""></div><div class="">```<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 27, 2020, at 7:30 PM, zhaoyonggang <<a href="mailto:yonggang.zhao@icloud.com" class="">yonggang.zhao@icloud.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">I have seen "clang-diagnostic-unreachable-code" when I use clang-tidy 7.0, is it removed from latest clang-tidy?<br class=""><br class=""><blockquote type="cite" class="">On Sep 27, 2020, at 6:27 PM, zhaoyonggang via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:<br class=""><br class="">Hi, all,<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>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.<br class=""><br class=""><blockquote type="cite" class="">$ /Users/zyg/Documents/workspace/llvm-project/llvm/cmake-build-debug/bin/clang-tidy --checks="-*,clang-diagnostic-*" --list-checks<br class=""></blockquote>No checks enabled.<br class="">_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></body></html>