From: Ted Kremenek Date: Wed, 2 Apr 2008 04:43:42 +0000 (+0000) Subject: Added special handling when the build command is "gcc", "cc", or "llvm-gcc"; X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dab111099e5e21b4f8eb929c7af9a7a0241eca98;p=clang Added special handling when the build command is "gcc", "cc", or "llvm-gcc"; in these cases we directly call ccc-analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49073 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/scan-build b/utils/scan-build index a9b454ab99..0822232e1b 100755 --- a/utils/scan-build +++ b/utils/scan-build @@ -141,6 +141,24 @@ sub Postprocess { } +##----------------------------------------------------------------------------## +# RunBuildCommand - Run the build command. +##----------------------------------------------------------------------------## + +sub RunBuildCommand { + + my $Args = shift; + my $Cmd = $Args->[0]; + + if ($Cmd =~ /gcc/ or $Cmd eq "cc" or $Cmd =~ /"llvm-gcc"/) { + shift @$Args; + unshift @$Args, "ccc-analyzer" + } + + system(@$Args); +} + + ##----------------------------------------------------------------------------## # DisplayHelp - Utility function to display all help options. ##----------------------------------------------------------------------------## @@ -161,13 +179,12 @@ OPTIONS: --help -k - Add "keep on going option" to the specified build command. - --keep-going This command currently supports "make" and "xcodebuild." You - can also directly specify the corresponding option to the - build command. - - -v - Verbose output from $Prog and the analyzer. A second - "-v" increases verbosity. + --keep-going This command currently supports make and xcodebuild. + This is a helper option; one can specify the arguments + directly as build options. + -v - Verbose output from $Prog and the analyzer. + A second "-v" increases verbosity. BUILD OPTIONS @@ -271,7 +288,7 @@ if ($Verbose >= 2) { # Run the build. -system(@ARGV); +RunBuildCommand(\@ARGV); # Postprocess the HTML directory.