aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-09-25 20:17:57 +0000
committerTed Kremenek <kremenek@apple.com>2008-09-25 20:17:57 +0000
commit27783eb8a030afd153280a15afdede29819d90d2 (patch)
treee59dd4f7e265fbb0ca5eb35929bffafd7a639a3a
parentb5f9a4ea171931a2092aa466046251629c75e65b (diff)
Emulate gcc driver-driver functionality: run analyzer separately for each separate -arch option.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56618 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-xutils/ccc-analyzer29
1 files changed, 25 insertions, 4 deletions
diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer
index 4f76250b5d..3f5ef2644b 100755
--- a/utils/ccc-analyzer
+++ b/utils/ccc-analyzer
@@ -246,6 +246,7 @@ if (!defined $Clang) { $Clang = 'clang'; }
# Get the HTML output directory.
my $HtmlDir = $ENV{'CCC_ANALYZER_HTML'};
+my %ArchsSeen;
# Process the arguments.
foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
@@ -255,7 +256,15 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) {
if ($Arg eq '-E') { $Action = 'preprocess'; }
elsif ($Arg eq '-c') { $Action = 'compile'; }
elsif ($Arg =~ /^-print-prog-name/) { exit 0; }
-
+
+ # Specially handle duplicate cases of -arch
+ if ($Arg eq "-arch") {
+ my $arch = $ARGV[$i+1];
+ $ArchsSeen{$arch} = 1;
+ ++$i;
+ next;
+ }
+
# Options with possible arguments that should pass through to compiler.
if (defined $CompileOptionMap{$Arg}) {
my $Cnt = $CompileOptionMap{$Arg};
@@ -390,11 +399,23 @@ if ($Action eq 'compile' or $Action eq 'link') {
push @AnalyzeArgs,@CompileOpts;
push @AnalyzeArgs,$file;
- Analyze($Clang, \@AnalyzeArgs, $FileLang, $Output,
- $Verbose, $HtmlDir, $file, $Analyses);
+ my @Archs = keys %ArchsSeen;
+ if (scalar @Archs) {
+ foreach my $arch (@Archs) {
+ my @NewArgs;
+ push @NewArgs, '-arch';
+ push @NewArgs, $arch;
+ push @NewArgs, @AnalyzeArgs;
+ Analyze($Clang, \@NewArgs, $FileLang, $Output,
+ $Verbose, $HtmlDir, $file, $Analyses);
+ }
+ }
+ else {
+ Analyze($Clang, \@AnalyzeArgs, $FileLang, $Output,
+ $Verbose, $HtmlDir, $file, $Analyses);
+ }
}
}
exit($Status >> 8);
-