<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Nov 17, 2013, at 9:12 PM, Tomasz Mikolajczyk <<a href="mailto:tmmikolajczyk@gmail.com">tmmikolajczyk@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>"sh: /Users/grubber/src/llvm-build/Debug+Asserts/bin: is a directory"<br><br></div>You mean --use-analyzer=/Users/grubber/src/llvm-build/Debug+Asserts/bin/clang++ I guess<br></div></blockquote><div><br></div><div>Right.</div><br><blockquote type="cite"><div class="gmail_extra">
<br></div></blockquote><div><br></div><div>Jared,</div><div><br></div><div>It really depends on what you are trying to debug.. </div><div><br></div><div>scan-build is a perl script located in clang/tools/scan-build folder. It calls clang on each file in your project asking it to perform "analyze" action. You can run it in verbose mode to see which clang commands get executed and see if your checker is passed to clang.</div><div><br></div><div>When debugging your checker implementation or BugReporterVisitors, you'd call clang directly with a command line similar to this: "<span style="font-family: Menlo; font-size: 11px;">clang -cc1 -analyze -analyzer-checker=core -analyzer-output=text</span>". You can add your checker after the "core" package on the command line. Also, note that the text output might be different from what you see in HTML or plist and it should only be used for debugging.</div></div><div><br></div><div>(When developing checkers, this page would definitely be useful: <a href="http://clang-analyzer.llvm.org/checker_dev_manual.html">http://clang-analyzer.llvm.org/checker_dev_manual.html</a>.)</div><div><br></div><div>Anna.<br><blockquote type="cite"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 18, 2013 at 3:44 AM, Jared Grubb <span dir="ltr"><<a href="mailto:jared.grubb@gmail.com" target="_blank">jared.grubb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">Is there a way to debug checkers and BugReporterVisitors? I'm trying to implement a visitor, but having trouble getting it to show any notes.<div><br></div><div>Based on your advice, I tried this:</div>
<div><br></div><div><div>$ /Users/grubber/src/llvm/tools/clang/tools/scan-build/scan-build --use-analyzer=/Users/grubber/src/llvm-build/Debug+Asserts/bin -v -v -v -enable-checker alpha.cplusplus.BlockRefCapture -enable-checker core --view clang++ -fblocks -std=c++11 blocks.cpp</div>
<div>sh: /Users/grubber/src/llvm-build/Debug+Asserts/bin: is a directory</div><div>scan-build: Using '/Users/grubber/src/llvm-build/Debug+Asserts/bin' for static analysis</div><div>scan-build: Emitting reports for this run to '/var/folders/fq/4_p48fh50_72j_gt7_pfgn_40000gn/T/scan-build-2013-11-17-184203-37891-1'.</div>
<div>clang++ -fblocks -std=c++11 blocks.cpp</div><div>scan-build: Removing directory '/var/folders/fq/4_p48fh50_72j_gt7_pfgn_40000gn/T/scan-build-2013-11-17-184203-37891-1' because it contains no reports.</div><div>
scan-build: No bugs found.</div></div><div><br></div><div>But that didnt find any issue, so I'm thinking it's not actually trying my alpha checker?</div><div><br></div><div>Jared</div><div><br><div><div>On Nov 14, 2013, at 9:27, Jordan Rose <<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>> wrote:</div>
<br><blockquote type="cite"><div style="word-wrap:break-word"><div>Hi, Richard. "clang --analyze” is not intended to be a usual interface for the analyzer, merely an invocation that higher-level tools can use. The correct way to run the analyzer, even on a single file, is through the <a href="http://clang-analyzer.llvm.org/scan-build.html" target="_blank">scan-build</a> tool, which provides HTML output that shows you the full path to the purported bug. (Or through Xcode, of course, if you’re on a Mac.)</div>
<div><br></div><div>Sorry for the inconvenience,</div><div>Jordan</div><div><br></div><br><div><div>On Nov 12, 2013, at 11:56 , Richard <<a href="mailto:legalize@xmission.com" target="_blank">legalize@xmission.com</a>> wrote:</div>
<br><blockquote type="cite">clang --analyze reports this problem in my code:<br><br>warning: Potential memory leak<br> for (extent_vector_iter deit = disk_.provided_extents.begin();<br> deit != disk_.provided_extents.end(); ++deit)<br>
^~<br>1 warning generated.<br><br>Context:<br><span style="white-space:pre-wrap"> </span>typedef std::vector<extent_data> extent_vector;<br><span style="white-space:pre-wrap"> </span>typedef extent_vector::const_iterator extent_vector_iter;<br>
<br><span style="white-space:pre-wrap"> </span>extent_data has no raw pointers, only non-pointer POD types and other<br><span style="white-space:pre-wrap"> </span>standard library classes like string and vector of string, etc.<br>
<br>The problem with this diagnostic is that it points to the place where<br>it thinks a memory leak may occur, but it doesn't provide me with a<br>chain of reasoning that makes me understand why it thinks this<br>particular chunk of code may leak memory.<br>
<br>Am I missing some magic flag to tell me this extra level of<br>information, or is that ability simply lacking?<br>-- <br>"The Direct3D Graphics Pipeline" free book <<a href="http://tinyurl.com/d3d-pipeline" target="_blank">http://tinyurl.com/d3d-pipeline</a>><br>
The Computer Graphics Museum <<a href="http://computergraphicsmuseum.org/" target="_blank">http://ComputerGraphicsMuseum.org</a>><br> The Terminals Wiki <<a href="http://terminals.classiccmp.org/" target="_blank">http://terminals.classiccmp.org</a>><br>
Legalize Adulthood! (my blog) <<a href="http://legalizeadulthood.wordpress.com/" target="_blank">http://LegalizeAdulthood.wordpress.com</a>><br>_______________________________________________<br>cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></blockquote>
</div><br></div>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br></body></html>