This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] fix an issue on #include<..> when using scan-build with -isystem
Needs ReviewPublic

Authored by takeshi-yoshimura on Jun 2 2015, 4:43 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

scan-build fails to perform static analysis if a hooked compilation uses
-isystem options in particular forms. It results in odd build errors,
which include<..>'ed files are not found even though the build before the
static analysis succeeds. This patch addresses a bug reported in PR13237:
https://llvm.org/bugs/show_bug.cgi?id=13237

The fault is a broken regular expression to extract paths after include
options string in ccc-analyzer. Specifically, the analyzer looks over the
path string after -isystem if we put a space between them. Note that scan-
build already can correctly parse the option when there are no spaces
between -isystem and the path (e.g., -isystem/path/to/dir/).

I also removed an FIXME near there since I do not think $ARGV[$i] can
overflow here. $ARGV overflows mean there are no strings after include
options. It prevents the compilation before static analysis from
succeeding, i.e., we cannot reach here.

Diff Detail

Event Timeline

takeshi-yoshimura retitled this revision from to [analyzer] fix an issue on #include<..> when using scan-build with -isystem.
takeshi-yoshimura updated this object.
takeshi-yoshimura edited the test plan for this revision. (Show Details)
takeshi-yoshimura added a subscriber: Unknown Object (MLST).