From: Artem Dergachev Date: Thu, 5 Sep 2019 00:44:56 +0000 (+0000) Subject: [analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fd7dbaf6705eabd70a8f63bca2e44fa2aec0c6d3;p=clang [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 --- diff --git a/tools/scan-build/libexec/ccc-analyzer b/tools/scan-build/libexec/ccc-analyzer index e1635e6c29..6d24a1af45 100755 --- a/tools/scan-build/libexec/ccc-analyzer +++ b/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; }