r371002 - [analyzer] scan-build: handle --sysroot=/path in addition to --sysroot /path.
Artem Dergachev via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 4 17:44:56 PDT 2019
Author: dergachev
Date: Wed Sep 4 17:44:56 2019
New Revision: 371002
URL: http://llvm.org/viewvc/llvm-project?rev=371002&view=rev
Log:
[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
Modified:
cfe/trunk/tools/scan-build/libexec/ccc-analyzer
Modified: cfe/trunk/tools/scan-build/libexec/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/libexec/ccc-analyzer?rev=371002&r1=371001&r2=371002&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/libexec/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/libexec/ccc-analyzer Wed Sep 4 17:44:56 2019
@@ -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);
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;
}
More information about the cfe-commits
mailing list