[PATCH] [analyzer] Add -analyzer-config option to scan-build.

Daniel Connelly dconnelly at google.com
Thu Dec 12 02:09:01 PST 2013


  Now handles multiple -analyzer-config options. (Duh, sorry about that.)

Hi jordan_rose,

http://llvm-reviews.chandlerc.com/D2382

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D2382?vs=6025&id=6053#toc

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
@@ -444,6 +444,9 @@
 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 (defined $ConfigOptions) {
+      push @AnalyzeArgs, split '\s+', $ConfigOptions;
+    }
 
     push @CmdArgs, @CompileOpts;
     push @CmdArgs, $file;
Index: tools/scan-build/scan-build
===================================================================
--- tools/scan-build/scan-build
+++ tools/scan-build/scan-build
@@ -885,7 +885,8 @@
 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 @@
  --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,7 +1489,13 @@
     $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 @@
 # 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 @@
   'VERBOSE' => $Verbose,
   'CCC_ANALYZER_ANALYSIS' => $CCC_ANALYZER_ANALYSIS,
   'CCC_ANALYZER_PLUGINS' => $CCC_ANALYZER_PLUGINS,
+  'CCC_ANALYZER_CONFIG' => $CCC_ANALYZER_CONFIG,
   'OUTPUT_DIR' => $HtmlDir
 );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2382.2.patch
Type: text/x-patch
Size: 2521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131212/b60326e8/attachment.bin>


More information about the cfe-commits mailing list