Added "-a" option to scan-build to select the analysis (ASTConsumer) used by clang. The default is -checker-cfref.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51116 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/scan-build b/utils/scan-build
index 890f014..c6647cd 100755
--- a/utils/scan-build
+++ b/utils/scan-build
@@ -523,14 +523,17 @@
OPTIONS:
+ -a - The analysis to run. The default is 'checker-cfref'.
+ Valid options are: 'checker-cfref', 'fsyntax-only'
+
-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
is created in /tmp to store the reports.
-
+
-h - Display this message.
--help
-
+
-k - Add a "keep on going" option to the specified build command.
--keep-going This option currently supports make and xcodebuild.
This is a convenience option; one can specify this
@@ -565,6 +568,7 @@
my $HtmlDir; # Parent directory to store HTML files.
my $IgnoreErrors = 0; # Ignore build errors.
my $ViewResults = 0; # View results when the build terminates.
+my $Analysis = "checker-cfref";
if (!@ARGV) {
DisplayHelp();
@@ -582,6 +586,22 @@
exit 0;
}
+ if ($arg eq "-a") {
+ shift @ARGV;
+
+ if (!@ARGV) {
+ die "$Prog: '-a' option requires an analysis type.\n";
+ }
+
+ $Analysis = shift @ARGV;
+
+ if (!($Analysis eq "checker-cfref" or $Analysis eq "fsyntax-only")) {
+ die "$Prog: Invalid argument '$Analysis' to -a.\n";
+ }
+
+ next;
+ }
+
if ($arg eq "-o") {
shift @ARGV;
@@ -667,6 +687,8 @@
$ENV{'CCC_ANALYZER_LOG'} = 1;
}
+$ENV{'CCC_ANALYZER_ANALYSIS'} = $Analysis;
+
# Run the build.
RunBuildCommand(\@ARGV, $IgnoreErrors);