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

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 : “test.cpp”

And when I ran,

scan-build –plist –v clang++ -c …/test/test.cpp

In the output report-*plist file the file name is “…/test/test.cpp”

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

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 : “test.cpp”

And when I ran,

scan-build –plist –v clang++ -c …/test/test.cpp

In the output report-*plist file the file name is “…/test/test.cpp”

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