[clang] 9f15f1f - [analyzer] Teach scan-build how to pass -analyzer-config to xcodebuild.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 28 14:34:42 PDT 2023


Author: Artem Dergachev
Date: 2023-03-28T14:34:28-07:00
New Revision: 9f15f1f0f3f58da8600c78c60032299f5ee4d6c5

URL: https://github.com/llvm/llvm-project/commit/9f15f1f0f3f58da8600c78c60032299f5ee4d6c5
DIFF: https://github.com/llvm/llvm-project/commit/9f15f1f0f3f58da8600c78c60032299f5ee4d6c5.diff

LOG: [analyzer] Teach scan-build how to pass -analyzer-config to xcodebuild.

The scan-build tool assists various build systems with applying the Clang
static analyzer alongside compilation. It offers explicit integration with
Xcode's native build system aka `xcodebuild`; in this case it doesn't
substitute the compiler, but instead kindly asks xcodebuild to enable
the static analyzer, something that it already knows how to do.

Make sure scan-build's `-analyzer-config` flag (which translates to a
similar `clang -cc1 -analyzer-config` flag) is properly translated
to Xcode build system. This unbreaks a few related features such as
checker silencing.

No LIT tests because they'd require an Xcode installation on your system.

Added: 
    

Modified: 
    clang/tools/scan-build/bin/scan-build

Removed: 
    


################################################################################
diff  --git a/clang/tools/scan-build/bin/scan-build b/clang/tools/scan-build/bin/scan-build
index 8cd525f054fdc..04734d9cfa9af 100755
--- a/clang/tools/scan-build/bin/scan-build
+++ b/clang/tools/scan-build/bin/scan-build
@@ -1037,7 +1037,8 @@ sub RunXcodebuild {
   if ($oldBehavior == 0) {
     my $OutputDir = $EnvVars->{"OUTPUT_DIR"};
     my $CLANG = $EnvVars->{"CLANG"};
-    my $OtherFlags = $EnvVars->{"CCC_ANALYZER_ANALYSIS"};
+    my $OtherFlags = $EnvVars->{"CCC_ANALYZER_ANALYSIS"} . " "
+                   . $EnvVars->{"CCC_ANALYZER_CONFIG"};
     push @$Args,
         "RUN_CLANG_STATIC_ANALYZER=YES",
         "CLANG_ANALYZER_OUTPUT=plist-html",


        


More information about the cfe-commits mailing list