[cfe-dev] clang --analyze: how do I get more verbose diagnostics?
Jordan Rose
jordan_rose at apple.com
Thu Nov 14 09:27:10 PST 2013
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 scan-build 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.)
Sorry for the inconvenience,
Jordan
On Nov 12, 2013, at 11:56 , Richard <legalize at xmission.com> wrote:
> clang --analyze reports this problem in my code:
>
> warning: Potential memory leak
> for (extent_vector_iter deit = disk_.provided_extents.begin();
> deit != disk_.provided_extents.end(); ++deit)
> ^~
> 1 warning generated.
>
> Context:
> typedef std::vector<extent_data> extent_vector;
> typedef extent_vector::const_iterator extent_vector_iter;
>
> extent_data has no raw pointers, only non-pointer POD types and other
> standard library classes like string and vector of string, etc.
>
> The problem with this diagnostic is that it points to the place where
> it thinks a memory leak may occur, but it doesn't provide me with a
> chain of reasoning that makes me understand why it thinks this
> particular chunk of code may leak memory.
>
> Am I missing some magic flag to tell me this extra level of
> information, or is that ability simply lacking?
> --
> "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
> The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
> The Terminals Wiki <http://terminals.classiccmp.org>
> Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131114/e1a151ac/attachment.html>
More information about the cfe-dev
mailing list