Skip to content

Commit

Permalink
[analyzer] Teach scan-build how to pass -analyzer-config to xcodebuild.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
haoNoQ committed Mar 28, 2023
1 parent 90b4d1b commit 9f15f1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clang/tools/scan-build/bin/scan-build
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 9f15f1f

Please sign in to comment.