[PATCH] [analyzer] Add -analyzer-config option to scan-build.
Daniel Connelly
dconnelly at google.com
Wed Dec 11 07:54:31 PST 2013
Hi jordan_rose,
Add a new -analyzer-config option to the scan-build tool. Its argument is passed to ccc-analyzer through the existing environment mechanism, and then on to Clang's -analyzer-config option. There was previously no way to pass -analyzer-config options to Clang using scan-build.
http://llvm-reviews.chandlerc.com/D2382
Files:
tools/scan-build/ccc-analyzer
tools/scan-build/scan-build
Index: tools/scan-build/ccc-analyzer
===================================================================
--- tools/scan-build/ccc-analyzer
+++ tools/scan-build/ccc-analyzer
@@ -417,6 +417,7 @@
my $Lang;
my $Output;
my %Uniqued;
+my $ConfigOptions;
# Forward arguments to gcc.
my $Status = system($Compiler, at ARGV);
@@ -444,6 +445,11 @@
my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'};
if (!defined $OutputFormat) { $OutputFormat = "html"; }
+# Get the config options.
+if (defined $ENV{'CCC_ANALYZER_CONFIG'}) {
+ $ConfigOptions = $ENV{'CCC_ANALYZER_CONFIG'};
+}
+
# Determine the level of verbosity.
my $Verbose = 0;
if (defined $ENV{'CCC_ANALYZER_VERBOSE'}) { $Verbose = 1; }
@@ -683,6 +689,10 @@
}
}
}
+ if (defined $ConfigOptions) {
+ push @AnalyzeArgs, '-analyzer-config';
+ push @AnalyzeArgs, $ConfigOptions;
+ }
push @CmdArgs, @CompileOpts;
push @CmdArgs, $file;
Index: tools/scan-build/scan-build
===================================================================
--- tools/scan-build/scan-build
+++ tools/scan-build/scan-build
@@ -892,7 +892,8 @@
foreach my $opt ('CCC_ANALYZER_STORE_MODEL',
'CCC_ANALYZER_PLUGINS',
'CCC_ANALYZER_INTERNAL_STATS',
- 'CCC_ANALYZER_OUTPUT_FORMAT') {
+ 'CCC_ANALYZER_OUTPUT_FORMAT',
+ 'CCC_ANALYZER_CONFIG') {
my $x = $Options->{$opt};
if (defined $x) { $ENV{$opt} = $x }
}
@@ -1164,6 +1165,10 @@
--override-compiler
Always resort to the ccc-analyzer even when better interposition methods
are available.
+
+ -analyzer-config <options>
+
+ Provide options to pass through to the analyzer's -analyzer-config flag.
CONTROLLING CHECKERS:
@@ -1336,6 +1341,7 @@
my $StoreModel;
my $ConstraintsModel;
my $InternalStats;
+my $ConfigOptions;
my $OutputFormat = "html";
my $AnalyzerStats = 0;
my $MaxLoop = 0;
@@ -1483,6 +1489,12 @@
$OutputFormat = "plist-html";
next;
}
+
+ if ($arg eq "-analyzer-config") {
+ shift @ARGV;
+ $ConfigOptions = shift @ARGV;
+ next;
+ }
if ($arg eq "-no-failure-reports") {
$ENV{"CCC_REPORT_FAILURES"} = 0;
@@ -1659,6 +1671,9 @@
if (defined $OutputFormat) {
$Options{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat;
}
+if (defined $ConfigOptions) {
+ $Options{'CCC_ANALYZER_CONFIG'} = $ConfigOptions;
+}
# Run the build.
my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd, $CmdCXX,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2382.1.patch
Type: text/x-patch
Size: 2510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131211/7fa07677/attachment.bin>
More information about the cfe-commits
mailing list