Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit fd7dbaf

Browse files
committed
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371002 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9fb69cd commit fd7dbaf

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/scan-build/libexec/ccc-analyzer

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,8 @@ my $HasSDK = 0;
498498
# Process the arguments.
499499
foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
500500
my $Arg = $ARGV[$i];
501-
my ($ArgKey) = split /=/,$Arg,2;
501+
my @ArgParts = split /=/,$Arg,2;
502+
my $ArgKey = @ArgParts[0];
502503

503504
# Be friendly to "" in the argument list.
504505
if (!defined($ArgKey)) {
@@ -566,10 +567,12 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
566567
push @CompileOpts,$Arg;
567568
push @LinkOpts,$Arg;
568569

569-
while ($Cnt > 0) {
570-
++$i; --$Cnt;
571-
push @CompileOpts, $ARGV[$i];
572-
push @LinkOpts, $ARGV[$i];
570+
if (scalar @ArgParts == 1) {
571+
while ($Cnt > 0) {
572+
++$i; --$Cnt;
573+
push @CompileOpts, $ARGV[$i];
574+
push @LinkOpts, $ARGV[$i];
575+
}
573576
}
574577
next;
575578
}

0 commit comments

Comments
 (0)