Discard extra -isysroot options. This fixes:
<rdar://problem/6253141> Parser rejection occurs when command line has more than one -isysroot switch
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56790 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer
index 3f5ef26..3388864 100755
--- a/utils/ccc-analyzer
+++ b/utils/ccc-analyzer
@@ -215,6 +215,10 @@
'mi' => 'objective-c-cpp-output'
);
+my %UniqueOptions = (
+ '-isysroot' => 0
+);
+
##----------------------------------------------------------------------------##
# Main Logic.
##----------------------------------------------------------------------------##
@@ -225,6 +229,7 @@
my @Files;
my $Lang;
my $Output;
+my %Uniqued;
# Forward arguments to gcc.
my $Status = system($CC,@ARGV);
@@ -287,6 +292,17 @@
my $Cnt = $CompilerLinkerOptionMap{$Arg};
push @CompileOpts,$Arg;
push @LinkOpts,$Arg;
+
+ # Check if this is an option that should have a unique value, and if so
+ # determine if the value was checked before.
+ if ($UniqueOptions{$Arg}) {
+ if (defined $Uniqued{$Arg}) {
+ $i += $Cnt;
+ next;
+ }
+ $Uniqued{$Arg} = 1;
+ }
+
while ($Cnt > 0) {
++$i; --$Cnt;
push @CompileOpts, $ARGV[$i];