From: Ted Kremenek Date: Mon, 29 Sep 2008 16:15:20 +0000 (+0000) Subject: Discard extra -isysroot options. This fixes: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a30730e5cd1aac279bf901050f8f0b6f22516010;p=clang Discard extra -isysroot options. This fixes: 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 3f5ef2644b..33888649c2 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -215,6 +215,10 @@ my %LangMap = ( 'mi' => 'objective-c-cpp-output' ); +my %UniqueOptions = ( + '-isysroot' => 0 +); + ##----------------------------------------------------------------------------## # Main Logic. ##----------------------------------------------------------------------------## @@ -225,6 +229,7 @@ my @LinkOpts; my @Files; my $Lang; my $Output; +my %Uniqued; # Forward arguments to gcc. my $Status = system($CC,@ARGV); @@ -287,6 +292,17 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { 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];