Skip to content

Commit

Permalink
[analyzer] scan-build: handle --sysroot=/path in addition to --sysroo…
Browse files Browse the repository at this point in the history
…t /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
  • Loading branch information
haoNoQ committed Sep 5, 2019
1 parent b7ebdbd commit 473d0d7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions clang/tools/scan-build/libexec/ccc-analyzer
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 473d0d7

Please sign in to comment.