[cfe-dev] Can Clang Static Analyzer's plist output include the file path?

Chris Ellsworth Chris.Ellsworth at avi.com
Sun Aug 11 10:41:18 PDT 2013


Hi Aditya,

Yes, you understood correctly. Thanks for the suggestions, they are much appreciated. Ultimately, I ended up just parsing the HTML output rather than the plist since I'm not looking for the users that will be running my application to have to perform additional processing on scan-build's output or modify their build process.

Thanks again,
Chris

From: Aditya Kumar <hiraditya at codeaurora.org<mailto:hiraditya at codeaurora.org>>
Date: Monday, August 5, 2013 12:00
To: Chris Ellsworth <Chris.Ellsworth at avi.com<mailto:Chris.Ellsworth at avi.com>>, "cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>" <cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>>
Subject: RE: [cfe-dev] Can Clang Static Analyzer's plist output include the file path?

If I understand correctly, you want the file names of the source files in the report-*.plist to refer to correct source file,
even if there are multiple file names having the same names as long as they are in different directories.

I ran scan-build for a test file using commands:
scan-build –plist –v clang++ -c test.cpp
and in the output .plist file the file name is : “<string>test.cpp</string>”

And when I ran,
scan-build –plist –v clang++ -c ../test/test.cpp
In the output report-*plist file the file name is “<string>../test/test.cpp</string>”

I can think of two methods to get what you want.

1.       If the build system passes the file name prepended with path to the clang front end the reports in the report-*.plist would have distinct file names. Sometimes build system change directories and then invokes the compiler. In that case, the compiler and hence the scan-build, will not know the full path of the file from the source tree.

2.       You can write a small post-process function which parses all the plist files and prepends all file names with paths from source tree.

hth,
-Aditya


From: cfe-dev-bounces at cs.uiuc.edu<mailto:cfe-dev-bounces at cs.uiuc.edu> [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Chris Ellsworth
Sent: Saturday, August 03, 2013 12:07 AM
To: cfe-dev at cs.uiuc.edu<mailto:cfe-dev at cs.uiuc.edu>
Subject: [cfe-dev] Can Clang Static Analyzer's plist output include the file path?

I'm looking to ingest the source of an application along with the Static Analyzer's output (scan-build -plist make) for that source. Plist seems like the logical output format since the report will be read programmatically, but I'm worried because it only shows file names, not paths. If there are two files within a source tree with the same name, it will be difficult to tell which plist goes with which file. Is there a way to get the path to the file in the plist, maybe similar to the way it is presented in the HTML output (relative to the directory that scan-build ran from)?

Thanks,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130811/3a1b0eec/attachment.html>


More information about the cfe-dev mailing list