From: Ted Kremenek Date: Sun, 19 Oct 2008 06:42:38 +0000 (+0000) Subject: Add "argument key" processing similar to ccc. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89c4fcfd056e65a47d713798bcd22d0273162c8a;p=clang Add "argument key" processing similar to ccc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57780 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index d99c7c7c33..4c47c098b7 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -257,8 +257,9 @@ my %ArchsSeen; # Process the arguments. foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { - my $Arg = $ARGV[$i]; - + my $Arg = $ARGV[$i]; + my ($ArgKey) = split /=/,$Arg,2; + # Modes ccc-analyzer supports if ($Arg eq '-E') { $Action = 'preprocess'; } elsif ($Arg eq '-c') { $Action = 'compile'; } @@ -273,16 +274,16 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { } # Options with possible arguments that should pass through to compiler. - if (defined $CompileOptionMap{$Arg}) { - my $Cnt = $CompileOptionMap{$Arg}; + if (defined $CompileOptionMap{$ArgKey}) { + my $Cnt = $CompileOptionMap{$ArgKey}; push @CompileOpts,$Arg; while ($Cnt > 0) { ++$i; --$Cnt; push @CompileOpts, $ARGV[$i]; } next; } # Options with possible arguments that should pass through to linker. - if (defined $LinkerOptionMap{$Arg}) { - my $Cnt = $LinkerOptionMap{$Arg}; + if (defined $LinkerOptionMap{$ArgKey}) { + my $Cnt = $LinkerOptionMap{$ArgKey}; push @LinkOpts,$Arg; while ($Cnt > 0) { ++$i; --$Cnt; push @LinkOpts, $ARGV[$i]; } next; @@ -290,8 +291,8 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { # Options with possible arguments that should pass through to both compiler # and the linker. - if (defined $CompilerLinkerOptionMap{$Arg}) { - my $Cnt = $CompilerLinkerOptionMap{$Arg}; + if (defined $CompilerLinkerOptionMap{$ArgKey}) { + my $Cnt = $CompilerLinkerOptionMap{$ArgKey}; # Check if this is an option that should have a unique value, and if so # determine if the value was checked before. @@ -315,8 +316,8 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { } # Ignored options. - if (defined $IgnoredOptionMap{$Arg}) { - my $Cnt = $IgnoredOptionMap{$Arg}; + if (defined $IgnoredOptionMap{$ArgKey}) { + my $Cnt = $IgnoredOptionMap{$ArgKey}; while ($Cnt > 0) { ++$i; --$Cnt; }