summaryrefslogtreecommitdiff
path: root/tools/scan-build
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-12-13 17:16:28 +0000
committerJordan Rose <jordan_rose@apple.com>2013-12-13 17:16:28 +0000
commit071d77afb13d3203e3cc638e20b4910db7d3a949 (patch)
tree5ae33e3af96343775145658ee7e56edfeeaba358 /tools/scan-build
parente3739cdb5fe9e51b464c8defce598d290466a712 (diff)
downloadclang-071d77afb13d3203e3cc638e20b4910db7d3a949.tar.gz
[analyzer] Add -analyzer-config to scan-build.
-analyzer-config options are now passed from scan-build through to ccc-analyzer and then to clang. Patch by Daniel Connelly! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197246 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/scan-build')
-rwxr-xr-xtools/scan-build/ccc-analyzer6
-rwxr-xr-xtools/scan-build/scan-build18
2 files changed, 22 insertions, 2 deletions
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer
index 969c1bbb08..ae114dffbb 100755
--- a/tools/scan-build/ccc-analyzer
+++ b/tools/scan-build/ccc-analyzer
@@ -444,6 +444,9 @@ my $InternalStats = $ENV{'CCC_ANALYZER_INTERNAL_STATS'};
my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'};
if (!defined $OutputFormat) { $OutputFormat = "html"; }
+# Get the config options.
+my $ConfigOptions = $ENV{'CCC_ANALYZER_CONFIG'};
+
# Determine the level of verbosity.
my $Verbose = 0;
if (defined $ENV{'CCC_ANALYZER_VERBOSE'}) { $Verbose = 1; }
@@ -683,6 +686,9 @@ if ($Action eq 'compile' or $Action eq 'link') {
}
}
}
+ if (defined $ConfigOptions) {
+ push @AnalyzeArgs, split '\s+', $ConfigOptions;
+ }
push @CmdArgs, @CompileOpts;
push @CmdArgs, $file;
diff --git a/tools/scan-build/scan-build b/tools/scan-build/scan-build
index 0f119f6049..e48a9b107e 100755
--- a/tools/scan-build/scan-build
+++ b/tools/scan-build/scan-build
@@ -885,7 +885,8 @@ sub AddIfNotPresent {
sub SetEnv {
my $Options = shift @_;
foreach my $opt ('CC', 'CXX', 'CLANG', 'CLANG_CXX',
- 'CCC_ANALYZER_ANALYSIS', 'CCC_ANALYZER_PLUGINS') {
+ 'CCC_ANALYZER_ANALYSIS', 'CCC_ANALYZER_PLUGINS',
+ 'CCC_ANALYZER_CONFIG') {
die "$opt is undefined\n" if (!defined $opt);
$ENV{$opt} = $Options->{$opt};
}
@@ -1164,6 +1165,10 @@ ADVANCED OPTIONS:
--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 @AnalysesToRun;
my $StoreModel;
my $ConstraintsModel;
my $InternalStats;
+my @ConfigOptions;
my $OutputFormat = "html";
my $AnalyzerStats = 0;
my $MaxLoop = 0;
@@ -1483,7 +1489,13 @@ while (@ARGV) {
$OutputFormat = "plist-html";
next;
}
-
+
+ if ($arg eq "-analyzer-config") {
+ shift @ARGV;
+ push @ConfigOptions, "-analyzer-config", shift @ARGV;
+ next;
+ }
+
if ($arg eq "-no-failure-reports") {
$ENV{"CCC_REPORT_FAILURES"} = 0;
next;
@@ -1636,6 +1648,7 @@ if ($MaxLoop > 0) { push @AnalysesToRun, "-analyzer-max-loop $MaxLoop"; }
# interposition.
my $CCC_ANALYZER_ANALYSIS = join ' ',@AnalysesToRun;
my $CCC_ANALYZER_PLUGINS = join ' ',@PluginsToLoad;
+my $CCC_ANALYZER_CONFIG = join ' ',@ConfigOptions;
my %Options = (
'CC' => $Cmd,
'CXX' => $CmdCXX,
@@ -1644,6 +1657,7 @@ my %Options = (
'VERBOSE' => $Verbose,
'CCC_ANALYZER_ANALYSIS' => $CCC_ANALYZER_ANALYSIS,
'CCC_ANALYZER_PLUGINS' => $CCC_ANALYZER_PLUGINS,
+ 'CCC_ANALYZER_CONFIG' => $CCC_ANALYZER_CONFIG,
'OUTPUT_DIR' => $HtmlDir
);