]> granicus.if.org Git - clang/commitdiff
Add store option to scan-build and ccc-analyzer.
authorZhongxing Xu <xuzhongxing@gmail.com>
Mon, 27 Oct 2008 14:26:32 +0000 (14:26 +0000)
committerZhongxing Xu <xuzhongxing@gmail.com>
Mon, 27 Oct 2008 14:26:32 +0000 (14:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58248 91177308-0d34-0410-b5e6-96231b3b80d8

utils/ccc-analyzer
utils/scan-build

index 4c47c098b7d5fceddf0b4f2dab1d88f454f982fa..9f07009f15c9a6205769aad4f365c8ba05461621 100755 (executable)
@@ -241,6 +241,9 @@ if ($Status) { exit($Status >> 8); }
 my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'};
 if (!defined($Analyses)) { $Analyses = '-checker-cfref'; }
 
+# Get the store model.
+my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'};
+
 # Determine the level of verbosity.
 my $Verbose = 0;
 if (defined $ENV{CCC_ANALYZER_VERBOSE}) { $Verbose = 1; }
@@ -416,9 +419,13 @@ if ($Action eq 'compile' or $Action eq 'link') {
       push @AnalyzeArgs,$FileLang;
     }
 
+    if (defined $StoreModel) {
+      push @AnalyzeArgs, $StoreModel;
+    }
+
     push @AnalyzeArgs,@CompileOpts;
     push @AnalyzeArgs,$file;
-    
+
     my @Archs = keys %ArchsSeen;
     if (scalar @Archs) {
       foreach my $arch (@Archs) {
index ef1b2c13341f6fe1b64df7e894fd6e75def8dc15..cd5a3073d46039ec4eed83810aab17df40cc26cd 100755 (executable)
@@ -808,6 +808,11 @@ OPTIONS:
 
  -analyze-headers - Also analyze functions in #included files.
 
+ -store [model] - Specify the store model used by the analyzer. By default,
+                  the 'basic' store model is used. 'region' specifies a field-
+                  sensitive store model. Be warned that the 'region' model
+                  is still in very early testing phase and may often crash.
+
  -o             - Target directory for HTML report files.  Subdirectories
                   will be created as needed to represent separate "runs" of
                   the analyzer.  If this option is not specified, a directory
@@ -918,6 +923,7 @@ my $IgnoreErrors = 0;  # Ignore build errors.
 my $ViewResults  = 0;  # View results when the build terminates.
 my $ExitStatusFoundBugs = 0; # Exit status reflects whether bugs were found
 my @AnalysesToRun;
+my $StoreModel;
 
 if (!@ARGV) {
   DisplayHelp();
@@ -1030,6 +1036,12 @@ while (@ARGV) {
     $ExitStatusFoundBugs = 1;
     next;
   }
+
+  if ($arg eq "-store") {
+    shift @ARGV;
+    $StoreModel = '-analyzer-store-' . shift @ARGV;
+    next;
+  }
   
   DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/);
   
@@ -1094,6 +1106,10 @@ if ($AnalyzeHeaders) {
 
 $ENV{'CCC_ANALYZER_ANALYSIS'} = join ' ',@AnalysesToRun;
 
+if ($StoreModel) {
+  $ENV{'CCC_ANALYZER_STORE_MODEL'} = $StoreModel;
+}
+
 # Run the build.
 my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd);