Index: tools/scan-build/ccc-analyzer =================================================================== --- tools/scan-build/ccc-analyzer +++ tools/scan-build/ccc-analyzer @@ -41,6 +41,7 @@ my $DefaultCCompiler; my $DefaultCXXCompiler; my $IsCXX; +my $Triple; # If on OSX, use xcrun to determine the SDK root. my $UseXCRUN = 0; @@ -77,6 +78,9 @@ $IsCXX = 0 } +$Triple = $ENV{'CLANG_TRIPLE'}; +#if (!defined $Triple || ! -x $Triple) { $Triple = ''; } + ##===----------------------------------------------------------------------===## # Cleanup. ##===----------------------------------------------------------------------===## @@ -237,6 +241,12 @@ my @PrintArgs; my $dir; + if (!defined $Triple || ! -x $Triple) { + else + push @CmdArgs, "-triple"; + push @CmdArgs, $Triple; + } + if ($Verbose) { $dir = getcwd(); print STDERR "\n[LOCATION]: $dir\n"; Index: tools/scan-build/scan-build =================================================================== --- tools/scan-build/scan-build +++ tools/scan-build/scan-build @@ -1150,6 +1150,11 @@ This is the same as "-use-cc" but for C++ code. + --triple [target triple name] + --triple=[target triple name] + + This provides target triple information to clang. + -v Enable verbose output from scan-build. A second and third '-v' increases @@ -1479,6 +1484,24 @@ next; } + if ($arg =~ /^--triple(=(.+))?$/) { + shift @ARGV; + my $triple; + + if (!defined $2 || $2 eq "") { + if (!@ARGV) { + DieDiag("'--triple' option requires a triple name.\n"); + } + $triple = shift @ARGV; + } + else { + $triple = $2; + } + + $ENV{"CLANG_TRIPLE"} = $triple; + next; + } + if ($arg eq "-v") { shift @ARGV; $Verbose++;