scan-build and paths spanning multiple files

A known limitation of the html output of scan-build is that it ignores
warnings whose paths spans more than one file [1]

Is there a way of obtaining the path associated to a warning when it
spans multiple files?

[1] http://llvm.org/bugs/show_bug.cgi?id=16489

There’s not currently a great way to do it. There’s an internal option named “-analyzer-output” which accepts the value “text”, but the display is currently broken in that path notes aren’t attached to their associated warnings. This wouldn’t be too hard to fix, but no one’s gotten around to it yet.

You could cheat by preprocessing the source first and then analyzing that, but the resulting syntax-colored HTML file is usually massive, bogging down many browsers.

Basically, no one’s put in the effort for this. …patches welcome?

Sorry,
Jordan

Jordan Rose <jordan_rose@apple.com>
writes:

You could cheat by preprocessing the source first and then analyzing
that, but the resulting syntax-colored HTML file is usually massive,
bogging down many browsers.

Preprocessing the source did the trick.

Thanks Jordan.

In addition, the analyzer’s plist output does support multi-file paths. So depending on how you consume the output this might be useful. Note, we change the format of the plist often and do not guarantee supporting it forever. However, there are python utilities in clang/utils/analyzer that can help you parse the output (CmpRuns.py); these are mainly used for testing now.

Anna.