Added --use-cc option to scan-build to allow the user to specify what compiler they want to use for code compilation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55142 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/scan-build b/utils/scan-build
index 44c2db3..d04c289 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -719,6 +719,10 @@
exit status of $Prog to be 1 if it found potential bugs
and 0 otherwise.
+ --use-cc [compiler path] - By default, $Prog uses 'gcc' to compile
+ --use-cc=[compiler path] your code. This option specifies what compiler
+ to use for regular code compilation.
+
-v - Verbose output from $Prog and the analyzer.
A second and third "-v" increases verbosity.
@@ -811,6 +815,24 @@
next;
}
+ if ($arg =~ /^--use-cc(=(.+))?$/) {
+ shift @ARGV;
+ my $cc;
+
+ if ($2 eq "") {
+ if (!@ARGV) {
+ DieDiag("'--use-cc' option requires a compiler executable name.\n");
+ }
+ $cc = shift @ARGV;
+ }
+ else {
+ $cc = $2;
+ }
+
+ $ENV{"CCC_CC"} = $cc;
+ next;
+ }
+
if ($arg eq "-v") {
shift @ARGV;
$Verbose++;