-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix scan-build support for sysroot= (#17)
- Loading branch information
Showing
4 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From 473d0d7f569c84446d9880727403524d4a9838eb Mon Sep 17 00:00:00 2001 | ||
From: Artem Dergachev <[email protected]> | ||
Date: Thu, 5 Sep 2019 00:44:56 +0000 | ||
Subject: [PATCH] [analyzer] scan-build: handle --sysroot=/path in addition to | ||
--sysroot /path. | ||
|
||
Current code assumes flags in CompilerLinkerOptionMap don't use =, | ||
which isn't always true. | ||
|
||
Patch by Chris Laplante! | ||
|
||
Differential Revision: https://reviews.llvm.org/D66569 | ||
|
||
llvm-svn: 371002 | ||
--- | ||
clang/tools/scan-build/libexec/ccc-analyzer | 13 ++++++++----- | ||
1 file changed, 8 insertions(+), 5 deletions(-) | ||
|
||
diff --git a/clang/tools/scan-build/libexec/ccc-analyzer b/clang/tools/scan-build/libexec/ccc-analyzer | ||
index e1635e6c29b8..6d24a1af4539 100755 | ||
--- a/clang/tools/scan-build/libexec/ccc-analyzer | ||
+++ b/clang/tools/scan-build/libexec/ccc-analyzer | ||
@@ -498,7 +498,8 @@ my $HasSDK = 0; | ||
# Process the arguments. | ||
foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { | ||
my $Arg = $ARGV[$i]; | ||
- my ($ArgKey) = split /=/,$Arg,2; | ||
+ my @ArgParts = split /=/,$Arg,2; | ||
+ my $ArgKey = @ArgParts[0]; | ||
|
||
# Be friendly to "" in the argument list. | ||
if (!defined($ArgKey)) { | ||
@@ -566,10 +567,12 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { | ||
push @CompileOpts,$Arg; | ||
push @LinkOpts,$Arg; | ||
|
||
- while ($Cnt > 0) { | ||
- ++$i; --$Cnt; | ||
- push @CompileOpts, $ARGV[$i]; | ||
- push @LinkOpts, $ARGV[$i]; | ||
+ if (scalar @ArgParts == 1) { | ||
+ while ($Cnt > 0) { | ||
+ ++$i; --$Cnt; | ||
+ push @CompileOpts, $ARGV[$i]; | ||
+ push @LinkOpts, $ARGV[$i]; | ||
+ } | ||
} | ||
next; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
From ea27b932b58cb6cf9d2f1ad1eddd187ee34b9a90 Mon Sep 17 00:00:00 2001 | ||
From: Sylvestre Ledru <[email protected]> | ||
Date: Fri, 13 Sep 2019 09:31:19 +0000 | ||
Subject: [PATCH] Fix a perl warning: Scalar value @ArgParts[0] better written | ||
as $ArgParts[0] at /usr/share/clang/scan-build-10/libexec/ccc-analyzer line | ||
502. | ||
|
||
llvm-svn: 371832 | ||
--- | ||
clang/tools/scan-build/libexec/ccc-analyzer | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/clang/tools/scan-build/libexec/ccc-analyzer b/clang/tools/scan-build/libexec/ccc-analyzer | ||
index 6d24a1af4539..800f38b5ba24 100755 | ||
--- a/clang/tools/scan-build/libexec/ccc-analyzer | ||
+++ b/clang/tools/scan-build/libexec/ccc-analyzer | ||
@@ -499,7 +499,7 @@ my $HasSDK = 0; | ||
foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { | ||
my $Arg = $ARGV[$i]; | ||
my @ArgParts = split /=/,$Arg,2; | ||
- my $ArgKey = @ArgParts[0]; | ||
+ my $ArgKey = $ArgParts[0]; | ||
|
||
# Be friendly to "" in the argument list. | ||
if (!defined($ArgKey)) { |