<div dir="ltr"><div><div><div><div>hey Martin, the checker name what you are looking for is 'alpha.deadcode.UnreachableCode'<br>also lower the bar for your test. (actually you are testing the checker not the scan-build tool now :))<br><br></div><div>/* this will trigger warning */<br></div><div>void foo() {<br> int i = 0;<br> return;<br> ++i;<br>}<br><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Nov 13, 2016 at 12:13 AM, Martin J. O'Riordan via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-IE"><div class="m_5260292851105995045WordSection1"><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">Thanks very much for your very helpful feedback, and I now have it mostly working. However, I must still be doing something wrong as I am not seeing any analysis reports, and it would be great if someone could point out what I am doing wrong.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">I am using ‘</span><span style="font-family:"Courier New";color:black">clang</span><span style="font-family:"Book Antiqua",serif;color:#002060">’ v3.9.0 built with Visual Studio 2013 on Windows, but running the test under Cygwin. In the description below I use the terms ‘</span><span style="font-family:"Courier New";color:black"><<i>tools-cygpath</i>></span><span style="font-family:"Book Antiqua",serif;color:#002060">’, ‘</span><span style="font-family:"Courier New";color:black"><<i>tools-WINPATH</i>></span><span style="font-family:"Book Antiqua",serif;color:#002060">’, ‘</span><span style="font-family:"Courier New";color:black"><<i>test-cygpath</i>></span><span style="font-family:"Book Antiqua",serif;color:#002060">’ and ‘</span><span style="font-family:"Courier New";color:black"><<i>test-WINPATH</i>></span><span style="font-family:"Book Antiqua",serif;color:#002060">’ to indicate the paths to the tools and test source from both Cygwin’s and Windows’ perspectives. The actual paths are too long to trouble you with, and not useful. My version of Perl on Cygwin is v5.14.4.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">The following describes how I am invoking ‘</span><span style="font-family:"Courier New";color:black">scan-build</span><span style="font-family:"Book Antiqua",serif;color:#002060">’ and my observations of its execution - sorry for the long description, but I did not want to elide anything that may be useful:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// How I invoke '</span></b><b><span style="font-family:"Courier New";color:black">scan-build</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">'::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"><<i>tools-cygpath</i>>/bin/scan-build \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> --use-cc clang \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> --use-c++ clang++ \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -enable-checker "core,security" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -v -v -v \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -o check \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> --html-title "Testing ScanBuild" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> make build<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// </span></b><b><span style="font-family:"Courier New";color:black">'scan-build</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">' invokes '</span></b><b><span style="font-family:"Courier New";color:black">c++-analyzer</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">' as follows (these are the parameters I pass to the compiler normally)::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"><<i>tools-cygpath</i>>/bin/../<wbr>libexec/c++-analyzer \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -v -c -Wall -fverbose-asm -UNDEBUG \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -O3 -std=c++14 testingScanBuild.cpp -o testingScanBuild.o<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// </span></b><b><span style="font-family:"Courier New";color:black">'c++-analyzer</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">' invokes my '</span></b><b><span style="font-family:"Courier New";color:black">clang++</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">' as follows (these are the normal options we expect)::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">"<<i>tools-WINPATH</i>>\\bin\\clang++<wbr>.exe" -cc1 -triple shave -S \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -disable-free -disable-llvm-verifier -discard-value-names \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -main-file-name testingScanBuild.cpp \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mrelocation-model static -mthread-model posix \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mdisable-fp-elim -masm-verbose -no-integrated-as -funroll-loops \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mllvm -unroll-allow-partial \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mno-zero-initialized-in-bss -fno-rtti \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mllvm -enable-misched \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mllvm -enable-aa-sched-mi \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mllvm -misched-bottomup \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -mllvm -misched=ilpmax \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -v -dwarf-column-info -debugger-tuning=gdb \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -coverage-file "<<i>test-WINPATH</i>>\\ScanBuild\\<wbr>testingScanBuild.o" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -resource-dir "<<i>tools-WINPATH</i>>\\bin\\..\\<wbr>lib\\clang\\3.9.0" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -U NDEBUG \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -internal-externc-isystem "<<i>tools-WINPATH</i>>\\include\\c++<wbr>" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -internal-externc-isystem "<<i>tools-WINPATH</i>>\\include" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -O3 -Wall -std=c++14 \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -fdeprecated-macro -fno-dwarf-directory-asm \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -fdebug-compilation-dir "<<i>test-WINPATH</i>>\\ScanBuild" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -ferror-limit 19 -fmessage-length 0 -ffreestanding \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -fallow-half-arguments-and-<wbr>returns -fobjc-runtime=gcc \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -fdiagnostics-show-option -vectorize-loops -vectorize-slp \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -o "D:\\tmp\\testingScanBuild-<wbr>413704.s" \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> -x c++ testingScanBuild.cpp<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// Then '</span></b><b><span style="font-family:"Courier New";color:black">c++-analyzer</span></b><b><span style="font-family:"Book Antiqua",serif;color:black">' reports this following which mirrors the usual<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// invocation, but also includes many Analysis options (indented)::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">[LOCATION]: <<i>test-cygpath</i>>/ScanBuild<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">#SHELL (cd '<<i>test-cygpath</i>>/ScanBuild' && '<<i>tools-cygpath</i>>/bin/clang' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-cc1' '-triple' 'shave' '-analyze' '-disable-free' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-disable-llvm-verifier' '-discard-value-names' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-main-file-name' 'testingScanBuild.cpp' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-store=region' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-opt-analyze-nested-<wbr>blocks' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-eagerly-assume' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=core' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=unix' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=deadcode' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=cplusplus' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.UncheckedReturn' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.getpw' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.gets' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.mktemp' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.mkstemp' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=security.<wbr>insecureAPI.vfork' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=<wbr>nullability.<wbr>NullPassedToNonnull' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker=<wbr>nullability.<wbr>NullReturnedFromNonnull' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-output' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> 'plist' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-w' '-mrelocation-model' 'static' '-mthread-model' 'posix' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mdisable-fp-elim' '-masm-verbose' '-no-integrated-as' '-funroll-loops' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mllvm' '-unroll-allow-partial' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mno-zero-initialized-in-bss' '-fno-rtti' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mllvm' '-enable-misched' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mllvm' '-enable-aa-sched-mi' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mllvm' '-misched-bottomup' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-mllvm' '-misched=ilpmax' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-v' '-dwarf-column-info' '-debugger-tuning=gdb' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-resource-dir' '<<i>tools-WINPATH</i>>\bin\..\lib\<wbr>clang\3.9.0' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-U' 'NDEBUG' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-internal-externc-isystem' '<<i>tools-WINPATH</i>>\include\c++' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-internal-externc-isystem' '<<i>tools-WINPATH</i>>\include' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-O3' '-std=c++14' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-fdeprecated-macro' '-fno-dwarf-directory-asm' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-fdebug-compilation-dir' '<<i>test-WINPATH</i>>\ScanBuild' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-ferror-limit' '19' '-fmessage-length' '0' '-ffreestanding' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-fallow-half-arguments-and-<wbr>returns' '-fobjc-runtime=gcc' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-fdiagnostics-show-option' '-vectorize-loops' '-vectorize-slp' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-display-progress' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-checker' 'core,security' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-opt-analyze-<wbr>headers' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-analyzer-output=html' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-o' '<<i>test-cygpath</i>>/ScanBuild/<wbr>check/2016-11-12-114955-13712-<wbr>1' \<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> '-x' 'c++' 'testingScanBuild.cpp')<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// The analyser reports the following progress, I have elided references to<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// headers and other non-relevant files::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Syntax): testingScanBuild.cpp verifyResult<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Syntax): testingScanBuild.cpp verifyResult<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Syntax): testingScanBuild.cpp main<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Syntax): testingScanBuild.cpp generateInputData<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Syntax): testingScanBuild.cpp generateOutputData<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">ANALYZE (Path, Inline_Regular): testingScanBuild.cpp main<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-family:"Book Antiqua",serif;color:black">// Finally it concludes with::<u></u><u></u></span></b></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">scan-build: Removing directory '<<i>test-cygpath</i>>/ScanBuild/<wbr>check/2016-11-12-115552-7812-<wbr>1' because it contains no reports.<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">scan-build: No bugs found.<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Book Antiqua",serif;color:black"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">But in my test, I have deliberately seeded it with unreachable code that I would expect the dead-code checker to find:<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">bool flag = someTestCondition == true;<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"><u></u> <u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">if (flag) {<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> doSomethingInteresting();<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">} else if (flag) { // Same test as above<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> unreachableCode(); // Expecting an SA diagnostic here<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">} else {<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black"> doNothing();<u></u><u></u></span></p><p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New";color:black">}<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">I’m sure that there is something really simple that I am missing, but I have no idea what it is.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#002060"> MartinO<u></u><u></u></span></p><p class="MsoNormal"><span style="font-family:"Book Antiqua",serif;color:#943634"><u></u> <u></u></span></p><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif" lang="EN-US"> Anna Zaks [mailto:<a href="mailto:ganna@apple.com" target="_blank">ganna@apple.com</a>] <br><b>Sent:</b> 11 November 2016 23:39<br><b>To:</b> Aleksei Sidorin <<a href="mailto:a.sidorin@samsung.com" target="_blank">a.sidorin@samsung.com</a>><br><b>Cc:</b> Martin J. O'Riordan <<a href="mailto:martin.oriordan@movidius.com" target="_blank">martin.oriordan@movidius.com</a>><wbr>; cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [cfe-dev] Learning how to use and deploy 'scan-build'<u></u><u></u></span></p></div></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal"><u></u> <u></u></p><div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal">On Nov 11, 2016, at 6:26 AM, Aleksei Sidorin via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p><div><div><p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif">Hello Martin!<br><br>11.11.2016 16:48, Martin J. O'Riordan via cfe-dev пишет:<u></u><u></u></span></p></div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt;font-variant-caps:normal;text-align:start;word-spacing:0px"><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">I am working on adding ‘scan-build’ to the set of tools we include with our release of ‘clang’, and trying to determine the minimal set of components needed to be able to successfully use ‘scan-build’. The documentation for this is fairly thin, so there are many things I am having to learn.</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">Currently we just provide the compiler itself, along with the headers and libraries for our SHAVE target. I would like to add a lot of the additional tools and utilities that CLang/LLVM provide with future versions, ‘scan-build’ is one of these, and ‘clang-tidy’, etc., but not a complete set.</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">In addition to the ‘scan-build’ Perl script itself, I also need the ‘ccc-analyzer’ and ‘c++-analyzer’ Perl scripts, and this appears to run without error; but I would like to know are their other components that I need to ensure that it is fully functional?</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div></blockquote><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">As I remember, Perl scan-build doesn't have any additional dependencies.</span><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br style="font-variant-caps:normal;text-align:start;word-spacing:0px"><br></span><u></u><u></u></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">I would like to know what is the “core set” of analysers? I listed the full set of analysers in ‘clang’ v3.9.0 and some of these names are prefixed with ‘core.’ so I presume these are the ones that comprise the core set? <span class="m_5260292851105995045apple-converted-space"> </span></span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div></blockquote><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">The "core" set is responsible for basic modelling of some functions in path-sensitive mode, they are not the analyzer core itself. Shortly, analyzer has two kinds of checkers - AST/CFG based (fast) and path-sensitive (slow but more powerful). If you need any path-sensitive checkers, you should also enable "core" checkers for more precise modelling.</span><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br><br><span style="background:white">// TODO: enable "core" automatically in such cases?</span></span><u></u><u></u></p></div></blockquote><div><p class="MsoNormal"><u></u> <u></u></p></div><p class="MsoNormal">I would recommend to start with the default set of checkers and disable the ones you do not find useful for your codebase (if any).<u></u><u></u></p></div><div><p class="MsoNormal"><br><br><u></u><u></u></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt;font-variant-caps:normal;text-align:start;word-spacing:0px"><div><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">When enabling others I presume I have to add a comma-separated list to the ‘-enable-checker’ option, for example ‘debug.Stats,unix.Malloc’. The names in the list of checks are formed with separating dot characters, does selecting something like ‘security’ enable all the checkers in the ‘security.*’ group, or do I have to enable them one at a time?</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div></blockquote><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">To enable a full package, you should just point it. Example: "-enable-checker core,security"</span><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br style="font-variant-caps:normal;text-align:start;word-spacing:0px"><br></span><u></u><u></u></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">Sorry if this is all answered in some part of the documentation I haven’t found, and please point me at it.</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div></blockquote><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">You can find some additional information on<span class="m_5260292851105995045apple-converted-space"> </span></span><a href="http://clang-analyzer.llvm.org/" target="_blank"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;color:#954f72;background:white">http://clang-analyzer.llvm.<wbr>org</span></a><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br style="font-variant-caps:normal;text-align:start;word-spacing:0px"><br></span><u></u><u></u></p><blockquote style="margin-top:5.0pt;margin-bottom:5.0pt"><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif">Thanks,</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> <span class="m_5260292851105995045apple-converted-space"> </span>MartinO</span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><div><p class="MsoNormal" style="background:white"><span style="font-family:"Calibri",sans-serif"> </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"><u></u><u></u></span></p></div><p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br><br><br><u></u><u></u></span></p><pre style="background:white">______________________________<wbr>_________________<u></u><u></u></pre><pre style="background:white">cfe-dev mailing list<u></u><u></u></pre><pre style="background:white"><a href="mailto:cfe-dev@lists.llvm.org" target="_blank"><span style="color:#954f72">cfe-dev@lists.llvm.org</span></a><u></u><u></u></pre><pre style="background:white"><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank"><span style="color:#954f72">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</span></a><u></u><u></u></pre></blockquote><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br style="font-variant-caps:normal;text-align:start;word-spacing:0px"><br></span><u></u><u></u></p><p class="MsoNormal" style="background:white"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><u></u> <u></u></span></p><pre style="background:white;font-variant-caps:normal;text-align:start;word-spacing:0px"><span style="font-size:9.0pt">-- <u></u><u></u></span></pre><pre style="background:white"><span style="font-size:9.0pt">Best regards,<u></u><u></u></span></pre><pre style="background:white"><span style="font-size:9.0pt">Aleksei Sidorin<u></u><u></u></span></pre><pre style="background:white"><span style="font-size:9.0pt">Software Engineer, <u></u><u></u></span></pre><pre style="background:white"><span style="font-size:9.0pt">IMSWL-IMCG, SRR, Samsung Electronics<u></u><u></u></span></pre><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;background:white">______________________________<wbr>_________________</span><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br><span style="background:white">cfe-dev mailing list</span><br></span><a href="mailto:cfe-dev@lists.llvm.org" target="_blank"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;color:#954f72;background:white">cfe-dev@lists.llvm.org</span></a><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif"><br></span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank"><span style="font-size:9.0pt;font-family:"Helvetica",sans-serif;color:#954f72;background:white">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</span></a><u></u><u></u></p></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>