diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-07-11 23:56:12 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-07-11 23:56:12 +0000 |
commit | 4aaedf03f5828c6fec07b28e723871ec7ef3ff5a (patch) | |
tree | 35e619d651f6d9e1ed4d93a49a001c0d968c9e3f /tools/scan-build | |
parent | fcb5a251e9c0c8c2d54323677d4f2ba5219301d0 (diff) | |
download | clang-4aaedf03f5828c6fec07b28e723871ec7ef3ff5a.tar.gz |
[scan-build] Pass through all -f and -O flags, along with -Wwrite-strings.
These flags control language options and user-visible macros, so it's
important to preserve them when analyzing. Rather than try to keep up
with all the -f flags, we'll pass them all through and then ban the ones
we don't want (like -fsyntax-only).
-Wwrite-strings is really an f-flag in disguise: it implies -fconst-strings.
Patch by Keaton Mowry, modified by me.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186138 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/scan-build')
-rwxr-xr-x | tools/scan-build/ccc-analyzer | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/tools/scan-build/ccc-analyzer b/tools/scan-build/ccc-analyzer index 7c41a0566d..0a51e529c7 100755 --- a/tools/scan-build/ccc-analyzer +++ b/tools/scan-build/ccc-analyzer @@ -325,11 +325,6 @@ sub Analyze { my %CompileOptionMap = ( '-nostdinc' => 0, - '-fblocks' => 0, - '-fno-builtin' => 0, - '-fobjc-gc-only' => 0, - '-fobjc-gc' => 0, - '-ffreestanding' => 0, '-include' => 1, '-idirafter' => 1, '-imacros' => 1, @@ -346,10 +341,8 @@ my %LinkerOptionMap = ( ); my %CompilerLinkerOptionMap = ( - '-fobjc-arc' => 0, - '-fno-objc-arc' => 0, - '-fobjc-abi-version' => 0, # This is really a 1 argument, but always has '=' - '-fobjc-legacy-dispatch' => 0, + '-Wwrite-strings' => 0 + '-ftrapv-handler' => 1, # specifically call out separated -f flag '-mios-simulator-version-min' => 0, # This really has 1 argument, but always has '=' '-isysroot' => 1, '-arch' => 1, @@ -357,7 +350,6 @@ my %CompilerLinkerOptionMap = ( '-m64' => 0, '-stdlib' => 0, # This is really a 1 argument, but always has '=' '-v' => 0, - '-fpascal-strings' => 0, '-mmacosx-version-min' => 0, # This is really a 1 argument, but always has '=' '-miphoneos-version-min' => 0 # This is really a 1 argument, but always has '=' ); @@ -574,6 +566,9 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { if ($Arg eq '-O') { push @LinkOpts,'-O1'; } elsif ($Arg eq '-Os') { push @LinkOpts,'-O2'; } else { push @LinkOpts,$Arg; } + + # Must pass this along for the __OPTIMIZE__ macro + if ($Arg =~ /^-O/) { push @CompileOpts,$Arg; } next; } @@ -582,12 +577,6 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { next; } -# if ($Arg =~ /^-f/) { -# # FIXME: Not sure if the remaining -fxxxx options have no arguments. -# push @CompileOpts,$Arg; -# push @LinkOpts,$Arg; # FIXME: Not sure if these are link opts. -# } - # Get the compiler/link mode. if ($Arg =~ /^-F(.+)$/) { my $Tmp = $Arg; @@ -611,6 +600,12 @@ foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { next; } + if ($Arg =~ /^-f/) { + push @CompileOpts,$Arg; + push @LinkOpts,$Arg; + next; + } + # Handle -Wno-. We don't care about extra warnings, but # we should suppress ones that we don't want to see. if ($Arg =~ /^-Wno-/) { |