]> granicus.if.org Git - clang/commitdiff
Discard extra -isysroot options. This fixes:
authorTed Kremenek <kremenek@apple.com>
Mon, 29 Sep 2008 16:15:20 +0000 (16:15 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 29 Sep 2008 16:15:20 +0000 (16:15 +0000)
<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

utils/ccc-analyzer

index 3f5ef2644bc6eaa81f815689b3f52b6b0c9fc57f..33888649c2baf87a8329a70e0a1ad83307e391ed 100755 (executable)
@@ -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];