[analyzer] Loading external plugins with scan-build

Load custom plugins when running scan-build. This is useful when
additional static analysis Checkers must be provided via clang's plugin
interface.

Loading additional plugins can now be done via the scan-build call:
scan-build -load-plugin <plugin.so>

A patch by Thomas Hauth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157452 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer
index d01bd0f..84d25ab 100755
--- a/tools/scan-build/ccc-analyzer
+++ b/tools/scan-build/ccc-analyzer
@@ -434,6 +434,9 @@
 # Get the analysis options.
 my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'};
 
+# Get the plugins to load.
+my $Plugins = $ENV{'CCC_ANALYZER_PLUGINS'};
+
 # Get the store model.
 my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'};
 
@@ -649,6 +652,10 @@
       push @AnalyzeArgs, split '\s+', $Analyses;
     }
 
+    if (defined $Plugins) {
+      push @AnalyzeArgs, split '\s+', $Plugins;
+    }
+
     if (defined $OutputFormat) {
       push @AnalyzeArgs, "-analyzer-output=" . $OutputFormat;
       if ($OutputFormat =~ /plist/) {