Index: test/Analysis/scan-build-isystem.h =================================================================== --- /dev/null +++ test/Analysis/scan-build-isystem.h @@ -0,0 +1 @@ +// dummy file \ No newline at end of file Index: test/Analysis/scan-build-isystem.c =================================================================== --- /dev/null +++ test/Analysis/scan-build-isystem.c @@ -0,0 +1,10 @@ +// RUN: perl %S/../../tools/scan-build/scan-build --use-analyzer %clang -o %t %clang_cc1 -isystem%S -fsyntax-only %s 2>&1 +// RUN: perl %S/../../tools/scan-build/scan-build --use-analyzer %clang -o %t %clang_cc1 -isystem %S -fsyntax-only %s 2>&1 +// ccc-analyzer has to correctly look up and include -isystem directory to avoid static analysis failures in scan-build. + +#include + +void f() { + int * i = 0; + *i = 1; // CHECK: Dereference of null pointer +} Index: tools/scan-build/ccc-analyzer =================================================================== --- tools/scan-build/ccc-analyzer +++ tools/scan-build/ccc-analyzer @@ -576,10 +576,9 @@ } # Compile mode flags. - if ($Arg =~ /^-[D,I,U,isystem](.*)$/) { + if ($Arg =~ /^-[D,I,U](.*)$/ || $Arg =~ /^-isystem(.*)$/) { my $Tmp = $Arg; if ($1 eq '') { - # FIXME: Check if we are going off the end. ++$i; $Tmp = $Arg . $ARGV[$i]; }