r197246 - [analyzer] Add -analyzer-config to scan-build.

Jordan Rose jordan_rose at apple.com
Fri Dec 13 09:16:28 PST 2013


Author: jrose
Date: Fri Dec 13 11:16:28 2013
New Revision: 197246

URL: http://llvm.org/viewvc/llvm-project?rev=197246&view=rev
Log:
[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!

Modified:
    cfe/trunk/tools/scan-build/ccc-analyzer
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/tools/scan-build/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=197246&r1=197245&r2=197246&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/ccc-analyzer Fri Dec 13 11:16:28 2013
@@ -444,6 +444,9 @@ my $InternalStats = $ENV{'CCC_ANALYZER_I
 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 '
         }
       }
     }
+    if (defined $ConfigOptions) {
+      push @AnalyzeArgs, split '\s+', $ConfigOptions;
+    }
 
     push @CmdArgs, @CompileOpts;
     push @CmdArgs, $file;

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=197246&r1=197245&r2=197246&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Fri Dec 13 11:16:28 2013
@@ -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,
 # interposition.
 my $CCC_ANALYZER_ANALYSIS = join ' ', at AnalysesToRun;
 my $CCC_ANALYZER_PLUGINS = join ' ', at PluginsToLoad;
+my $CCC_ANALYZER_CONFIG = join ' ', at 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
 );
 





More information about the cfe-commits mailing list