Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 2 | # |
| 3 | # The LLVM Compiler Infrastructure |
| 4 | # |
| 5 | # This file is distributed under the University of Illinois Open Source |
| 6 | # License. See LICENSE.TXT for details. |
| 7 | # |
| 8 | ##===----------------------------------------------------------------------===## |
| 9 | # |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 10 | # A script designed to interpose between the build system and gcc. It invokes |
| 11 | # both gcc and the static analyzer. |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 12 | # |
| 13 | ##===----------------------------------------------------------------------===## |
| 14 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 15 | use strict; |
| 16 | use warnings; |
Ted Kremenek | b315a39 | 2008-09-21 19:56:14 +0000 | [diff] [blame] | 17 | use Cwd qw/ getcwd abs_path /; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 18 | use File::Temp qw/ tempfile /; |
| 19 | use File::Path qw / mkpath /; |
Ted Kremenek | ddf32da | 2009-01-21 00:42:24 +0000 | [diff] [blame] | 20 | use File::Basename; |
Ted Kremenek | 1df35e3 | 2009-05-11 23:29:51 +0000 | [diff] [blame] | 21 | use Text::ParseWords; |
Ted Kremenek | 2ec5cd5 | 2008-08-25 20:44:31 +0000 | [diff] [blame] | 22 | |
| 23 | my $CC = $ENV{'CCC_CC'}; |
| 24 | if (!defined $CC) { $CC = "gcc"; } |
Ted Kremenek | e600bed | 2009-07-30 23:55:19 +0000 | [diff] [blame] | 25 | |
| 26 | my $ReportFailures = $ENV{'CCC_REPORT_FAILURES'}; |
| 27 | if (!defined $ReportFailures) { $ReportFailures = 1; } |
| 28 | |
Ted Kremenek | ddf32da | 2009-01-21 00:42:24 +0000 | [diff] [blame] | 29 | my $CleanupFile; |
| 30 | my $ResultFile; |
| 31 | |
| 32 | # Remove any stale files at exit. |
| 33 | END { |
| 34 | if (defined $CleanupFile && -z $CleanupFile) { |
| 35 | `rm -f $CleanupFile`; |
| 36 | } |
| 37 | } |
| 38 | |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 39 | ##----------------------------------------------------------------------------## |
| 40 | # Process Clang Crashes. |
| 41 | ##----------------------------------------------------------------------------## |
| 42 | |
| 43 | sub GetPPExt { |
| 44 | my $Lang = shift; |
| 45 | if ($Lang =~ /objective-c/) { return ".mi"; } |
| 46 | return ".i"; |
| 47 | } |
| 48 | |
Ted Kremenek | a4d8cde | 2009-04-28 17:37:44 +0000 | [diff] [blame] | 49 | # Set this to 1 if we want to include 'parser rejects' files. |
| 50 | my $IncludeParserRejects = 0; |
Ted Kremenek | 5daa3be | 2009-01-27 01:19:08 +0000 | [diff] [blame] | 51 | my $ParserRejects = "Parser Rejects"; |
Ted Kremenek | a4d8cde | 2009-04-28 17:37:44 +0000 | [diff] [blame] | 52 | |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 53 | my $AttributeIgnored = "Attribute Ignored"; |
Ted Kremenek | 5daa3be | 2009-01-27 01:19:08 +0000 | [diff] [blame] | 54 | |
Ted Kremenek | 5d31f83 | 2008-08-18 18:38:29 +0000 | [diff] [blame] | 55 | sub ProcessClangFailure { |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 56 | my ($ClangCC, $Lang, $file, $Args, $HtmlDir, $ErrorType, $ofile) = @_; |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 57 | my $Dir = "$HtmlDir/failures"; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 58 | mkpath $Dir; |
Ted Kremenek | 5daa3be | 2009-01-27 01:19:08 +0000 | [diff] [blame] | 59 | |
| 60 | my $prefix = "clang_crash"; |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 61 | if ($ErrorType eq $ParserRejects) { |
| 62 | $prefix = "clang_parser_rejects"; |
| 63 | } |
| 64 | elsif ($ErrorType eq $AttributeIgnored) { |
| 65 | $prefix = "clang_attribute_ignored"; |
| 66 | } |
Ted Kremenek | c3998fa | 2008-09-25 00:51:44 +0000 | [diff] [blame] | 67 | |
Ted Kremenek | 3386c8a | 2009-07-28 00:14:21 +0000 | [diff] [blame] | 68 | # Generate the preprocessed file with Clang. |
Ted Kremenek | 5daa3be | 2009-01-27 01:19:08 +0000 | [diff] [blame] | 69 | my ($PPH, $PPFile) = tempfile( $prefix . "_XXXXXX", |
| 70 | SUFFIX => GetPPExt($Lang), |
| 71 | DIR => $Dir); |
Ted Kremenek | 3386c8a | 2009-07-28 00:14:21 +0000 | [diff] [blame] | 72 | system $ClangCC, @$Args, "-E", "-o", $PPFile; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 73 | close ($PPH); |
Ted Kremenek | c3998fa | 2008-09-25 00:51:44 +0000 | [diff] [blame] | 74 | |
| 75 | # Create the info file. |
Ted Kremenek | 82a1253 | 2008-09-25 00:25:16 +0000 | [diff] [blame] | 76 | open (OUT, ">", "$PPFile.info.txt") or die "Cannot open $PPFile.info.txt\n"; |
Ted Kremenek | 5f2825f | 2008-09-21 18:04:49 +0000 | [diff] [blame] | 77 | print OUT abs_path($file), "\n"; |
Ted Kremenek | 5d31f83 | 2008-08-18 18:38:29 +0000 | [diff] [blame] | 78 | print OUT "$ErrorType\n"; |
Ted Kremenek | 2dd7ad1 | 2008-08-18 20:55:25 +0000 | [diff] [blame] | 79 | print OUT "@$Args\n"; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 80 | close OUT; |
Ted Kremenek | 82a1253 | 2008-09-25 00:25:16 +0000 | [diff] [blame] | 81 | `uname -a >> $PPFile.info.txt 2>&1`; |
| 82 | `$CC -v >> $PPFile.info.txt 2>&1`; |
Ted Kremenek | 9f9b1fd | 2008-09-12 22:49:36 +0000 | [diff] [blame] | 83 | system 'mv',$ofile,"$PPFile.stderr.txt"; |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 84 | return (basename $PPFile); |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 85 | } |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 86 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 87 | ##----------------------------------------------------------------------------## |
| 88 | # Running the analyzer. |
| 89 | ##----------------------------------------------------------------------------## |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 90 | |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 91 | # Determine what clang executable to use. |
| 92 | my $Clang = $ENV{'CLANG'}; |
| 93 | if (!defined $Clang) { $Clang = 'clang'; } |
| 94 | |
| 95 | sub GetCCArgs { |
| 96 | my $Args = shift; |
| 97 | |
| 98 | pipe (FROM_CHILD, TO_PARENT); |
| 99 | my $pid = fork(); |
| 100 | if ($pid == 0) { |
| 101 | close FROM_CHILD; |
| 102 | open(STDOUT,">&", \*TO_PARENT); |
| 103 | open(STDERR,">&", \*TO_PARENT); |
| 104 | exec $Clang, "-###", "-fsyntax-only", @$Args; |
| 105 | } |
| 106 | close(TO_PARENT); |
| 107 | my $line; |
| 108 | while (<FROM_CHILD>) { |
| 109 | next if (!/clang-cc/); |
| 110 | $line = $_; |
| 111 | } |
| 112 | |
| 113 | waitpid($pid,0); |
| 114 | close(FROM_CHILD); |
| 115 | |
| 116 | die "could not find clang-cc line\n" if (!defined $line); |
Ted Kremenek | 1df35e3 | 2009-05-11 23:29:51 +0000 | [diff] [blame] | 117 | # Strip the newline and initial whitspace |
| 118 | chomp $line; |
| 119 | $line =~ s/^\s+//; |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 120 | |
Ted Kremenek | 621cc4e | 2009-05-15 04:07:18 +0000 | [diff] [blame] | 121 | my @items = quotewords('\s+', 1, $line); |
| 122 | for (my $i = 0 ; $ i < scalar(@items); ++$i) { |
| 123 | $items[$i] =~ s/^\"//; |
| 124 | $items[$i] =~ s/\"$//; |
| 125 | } |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 126 | my $cmd = shift @items; |
| 127 | die "cannot find 'clang-cc' in 'clang' command\n" if (!($cmd =~ /clang-cc/)); |
| 128 | return \@items; |
| 129 | } |
| 130 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 131 | sub Analyze { |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 132 | my ($ClangCC, $Args, $AnalyzeArgs, $Lang, $Output, $Verbose, $HtmlDir, |
| 133 | $file, $Analyses) = @_; |
Ted Kremenek | efaf191 | 2009-05-11 21:08:34 +0000 | [diff] [blame] | 134 | |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 135 | $Args = GetCCArgs($Args); |
Seo Sanghyeon | d389465 | 2008-04-04 11:02:21 +0000 | [diff] [blame] | 136 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 137 | # Skip anything related to C++. |
| 138 | return if ($Lang =~ /c[+][+]/); |
Ted Kremenek | 5d31f83 | 2008-08-18 18:38:29 +0000 | [diff] [blame] | 139 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 140 | my $RunAnalyzer = 0; |
| 141 | my $Cmd; |
| 142 | my @CmdArgs; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 143 | my @CmdArgsSansAnalyses; |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 144 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 145 | if ($Lang =~ /header/) { |
| 146 | exit 0 if (!defined ($Output)); |
| 147 | $Cmd = 'cp'; |
| 148 | push @CmdArgs,$file; |
| 149 | # Remove the PCH extension. |
| 150 | $Output =~ s/[.]gch$//; |
| 151 | push @CmdArgs,$Output; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 152 | @CmdArgsSansAnalyses = @CmdArgs; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 153 | } |
| 154 | else { |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 155 | $Cmd = $ClangCC; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 156 | push @CmdArgs,'-DIBOutlet=__attribute__((iboutlet))'; |
| 157 | push @CmdArgs,@$Args; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 158 | @CmdArgsSansAnalyses = @CmdArgs; |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 159 | push @CmdArgs,'-analyze'; |
| 160 | push @CmdArgs,"-analyzer-display-progress"; |
Ted Kremenek | a2bdaf5 | 2009-02-26 17:36:31 +0000 | [diff] [blame] | 161 | push @CmdArgs,"-analyzer-eagerly-assume"; |
Ted Kremenek | b40d06d | 2009-12-07 22:26:14 +0000 | [diff] [blame^] | 162 | push @CmdArgs,"-analyzer-opt-analyze-nested-blocks"; |
Ted Kremenek | 991c54b | 2008-08-08 20:46:42 +0000 | [diff] [blame] | 163 | push @CmdArgs,(split /\s/,$Analyses); |
Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame] | 164 | |
| 165 | if (defined $ENV{"CCC_EXPERIMENTAL_CHECKS"}) { |
| 166 | push @CmdArgs,"-analyzer-experimental-internal-checks"; |
Ted Kremenek | 2a1814a | 2009-11-13 18:49:48 +0000 | [diff] [blame] | 167 | push @CmdArgs,"-analyzer-experimental-checks"; |
Ted Kremenek | 8382cf5 | 2009-11-13 18:46:29 +0000 | [diff] [blame] | 168 | } |
| 169 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 170 | $RunAnalyzer = 1; |
| 171 | } |
| 172 | |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 173 | # Add the analysis arguments passed down from scan-build. |
| 174 | foreach my $Arg (@$AnalyzeArgs) { |
| 175 | push @CmdArgs, $Arg; |
| 176 | } |
| 177 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 178 | my @PrintArgs; |
| 179 | my $dir; |
Ted Kremenek | 63fe5ec | 2009-08-02 05:42:46 +0000 | [diff] [blame] | 180 | |
| 181 | if ($RunAnalyzer) { |
| 182 | if (defined $ResultFile) { |
| 183 | push @CmdArgs,'-o'; |
| 184 | push @CmdArgs, $ResultFile; |
| 185 | } |
| 186 | elsif (defined $HtmlDir) { |
| 187 | push @CmdArgs,'-o'; |
| 188 | push @CmdArgs, $HtmlDir; |
| 189 | } |
| 190 | } |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 191 | |
| 192 | if ($Verbose) { |
| 193 | $dir = getcwd(); |
| 194 | print STDERR "\n[LOCATION]: $dir\n"; |
| 195 | push @PrintArgs,"'$Cmd'"; |
| 196 | foreach my $arg (@CmdArgs) { push @PrintArgs,"\'$arg\'"; } |
| 197 | } |
| 198 | |
| 199 | if ($Verbose == 1) { |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 200 | # We MUST print to stderr. Some clients use the stdout output of |
| 201 | # gcc for various purposes. |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 202 | print STDERR join(' ',@PrintArgs); |
| 203 | print STDERR "\n"; |
| 204 | } |
| 205 | elsif ($Verbose == 2) { |
| 206 | print STDERR "#SHELL (cd '$dir' && @PrintArgs)\n"; |
| 207 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 208 | |
Ted Kremenek | 948e06b | 2008-08-27 22:30:34 +0000 | [diff] [blame] | 209 | if (defined $ENV{'CCC_UBI'}) { |
| 210 | push @CmdArgs,"--analyzer-viz-egraph-ubigraph"; |
| 211 | } |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 212 | |
Ted Kremenek | 9a3c7da | 2008-09-04 00:02:34 +0000 | [diff] [blame] | 213 | # Capture the STDERR of clang and send it to a temporary file. |
| 214 | # Capture the STDOUT of clang and reroute it to ccc-analyzer's STDERR. |
| 215 | # We save the output file in the 'crashes' directory if clang encounters |
| 216 | # any problems with the file. |
Ted Kremenek | 1346268 | 2008-09-11 23:05:26 +0000 | [diff] [blame] | 217 | pipe (FROM_CHILD, TO_PARENT); |
Ted Kremenek | 9a3c7da | 2008-09-04 00:02:34 +0000 | [diff] [blame] | 218 | my $pid = fork(); |
| 219 | if ($pid == 0) { |
Ted Kremenek | 1346268 | 2008-09-11 23:05:26 +0000 | [diff] [blame] | 220 | close FROM_CHILD; |
| 221 | open(STDOUT,">&", \*TO_PARENT); |
| 222 | open(STDERR,">&", \*TO_PARENT); |
Ted Kremenek | 9a3c7da | 2008-09-04 00:02:34 +0000 | [diff] [blame] | 223 | exec $Cmd, @CmdArgs; |
| 224 | } |
Ted Kremenek | 1346268 | 2008-09-11 23:05:26 +0000 | [diff] [blame] | 225 | |
| 226 | close TO_PARENT; |
| 227 | my ($ofh, $ofile) = tempfile("clang_output_XXXXXX", DIR => $HtmlDir); |
| 228 | |
| 229 | while (<FROM_CHILD>) { |
| 230 | print $ofh $_; |
| 231 | print STDERR $_; |
| 232 | } |
| 233 | |
| 234 | waitpid($pid,0); |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 235 | close(FROM_CHILD); |
Ted Kremenek | 9a3c7da | 2008-09-04 00:02:34 +0000 | [diff] [blame] | 236 | my $Result = $?; |
| 237 | |
| 238 | # Did the command die because of a signal? |
Ted Kremenek | e600bed | 2009-07-30 23:55:19 +0000 | [diff] [blame] | 239 | if ($ReportFailures) { |
| 240 | if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) { |
| 241 | ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, |
| 242 | $HtmlDir, "Crash", $ofile); |
Ted Kremenek | 5de4092 | 2009-02-27 06:17:38 +0000 | [diff] [blame] | 243 | } |
Ted Kremenek | e600bed | 2009-07-30 23:55:19 +0000 | [diff] [blame] | 244 | elsif ($Result) { |
| 245 | if ($IncludeParserRejects && !($file =~/conftest/)) { |
| 246 | ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, |
| 247 | $HtmlDir, $ParserRejects, $ofile); |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 248 | } |
Ted Kremenek | e600bed | 2009-07-30 23:55:19 +0000 | [diff] [blame] | 249 | } |
| 250 | else { |
| 251 | # Check if there were any unhandled attributes. |
| 252 | if (open(CHILD, $ofile)) { |
| 253 | my %attributes_not_handled; |
| 254 | |
| 255 | # Don't flag warnings about the following attributes that we |
| 256 | # know are currently not supported by Clang. |
| 257 | $attributes_not_handled{"cdecl"} = 1; |
| 258 | |
| 259 | my $ppfile; |
| 260 | while (<CHILD>) { |
| 261 | next if (! /warning: '([^\']+)' attribute ignored/); |
| 262 | |
| 263 | # Have we already spotted this unhandled attribute? |
| 264 | next if (defined $attributes_not_handled{$1}); |
| 265 | $attributes_not_handled{$1} = 1; |
| 266 | |
| 267 | # Get the name of the attribute file. |
| 268 | my $dir = "$HtmlDir/failures"; |
| 269 | my $afile = "$dir/attribute_ignored_$1.txt"; |
| 270 | |
| 271 | # Only create another preprocessed file if the attribute file |
| 272 | # doesn't exist yet. |
| 273 | next if (-e $afile); |
| 274 | |
| 275 | # Add this file to the list of files that contained this attribute. |
| 276 | # Generate a preprocessed file if we haven't already. |
| 277 | if (!(defined $ppfile)) { |
| 278 | $ppfile = ProcessClangFailure($ClangCC, $Lang, $file, |
| 279 | \@CmdArgsSansAnalyses, |
| 280 | $HtmlDir, $AttributeIgnored, $ofile); |
| 281 | } |
| 282 | |
| 283 | mkpath $dir; |
| 284 | open(AFILE, ">$afile"); |
| 285 | print AFILE "$ppfile\n"; |
| 286 | close(AFILE); |
| 287 | } |
| 288 | close CHILD; |
| 289 | } |
Ted Kremenek | 938eef1 | 2009-02-17 23:31:05 +0000 | [diff] [blame] | 290 | } |
| 291 | } |
Ted Kremenek | 9a3c7da | 2008-09-04 00:02:34 +0000 | [diff] [blame] | 292 | |
Ted Kremenek | e3bf8a8 | 2009-08-04 00:55:59 +0000 | [diff] [blame] | 293 | unlink($ofile); |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 294 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 295 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 296 | ##----------------------------------------------------------------------------## |
| 297 | # Lookup tables. |
| 298 | ##----------------------------------------------------------------------------## |
| 299 | |
| 300 | my %CompileOptionMap = ( |
| 301 | '-nostdinc' => 0, |
Anders Carlsson | 06c58b1 | 2008-12-19 20:56:23 +0000 | [diff] [blame] | 302 | '-fblocks' => 0, |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 303 | '-fobjc-gc-only' => 0, |
Ted Kremenek | 6c4312d | 2009-02-26 23:09:43 +0000 | [diff] [blame] | 304 | '-fobjc-gc' => 0, |
| 305 | '-ffreestanding' => 0, |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 306 | '-include' => 1, |
| 307 | '-idirafter' => 1, |
| 308 | '-iprefix' => 1, |
| 309 | '-iquote' => 1, |
| 310 | '-isystem' => 1, |
| 311 | '-iwithprefix' => 1, |
| 312 | '-iwithprefixbefore' => 1 |
| 313 | ); |
| 314 | |
| 315 | my %LinkerOptionMap = ( |
| 316 | '-framework' => 1 |
| 317 | ); |
| 318 | |
| 319 | my %CompilerLinkerOptionMap = ( |
| 320 | '-isysroot' => 1, |
| 321 | '-arch' => 1, |
Ted Kremenek | e4f6952 | 2008-09-29 22:45:28 +0000 | [diff] [blame] | 322 | '-v' => 0, |
Ted Kremenek | b10362a | 2008-09-30 23:40:25 +0000 | [diff] [blame] | 323 | '-fpascal-strings' => 0, |
Daniel Dunbar | 8d33cd7 | 2009-04-10 19:52:24 +0000 | [diff] [blame] | 324 | '-mmacosx-version-min' => 0, # This is really a 1 argument, but always has '=' |
| 325 | '-miphoneos-version-min' => 0 # This is really a 1 argument, but always has '=' |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 326 | ); |
| 327 | |
| 328 | my %IgnoredOptionMap = ( |
Ted Kremenek | 9402609 | 2008-07-24 03:52:21 +0000 | [diff] [blame] | 329 | '-MT' => 1, # Ignore these preprocessor options. |
| 330 | '-MF' => 1, |
| 331 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 332 | '-fsyntax-only' => 0, |
| 333 | '-save-temps' => 0, |
| 334 | '-install_name' => 1, |
| 335 | '-exported_symbols_list' => 1, |
| 336 | '-current_version' => 1, |
| 337 | '-compatibility_version' => 1, |
| 338 | '-init' => 1, |
| 339 | '-e' => 1, |
| 340 | '-seg1addr' => 1, |
| 341 | '-bundle_loader' => 1, |
| 342 | '-multiply_defined' => 1, |
| 343 | '-sectorder' => 3, |
| 344 | '--param' => 1, |
| 345 | '-u' => 1 |
| 346 | ); |
| 347 | |
| 348 | my %LangMap = ( |
| 349 | 'c' => 'c', |
| 350 | 'cpp' => 'c++', |
| 351 | 'cc' => 'c++', |
| 352 | 'i' => 'c-cpp-output', |
| 353 | 'm' => 'objective-c', |
| 354 | 'mi' => 'objective-c-cpp-output' |
| 355 | ); |
| 356 | |
Ted Kremenek | a30730e | 2008-09-29 16:15:20 +0000 | [diff] [blame] | 357 | my %UniqueOptions = ( |
| 358 | '-isysroot' => 0 |
| 359 | ); |
| 360 | |
Ted Kremenek | efaf191 | 2009-05-11 21:08:34 +0000 | [diff] [blame] | 361 | my %LangsAccepted = ( |
| 362 | "objective-c" => 1, |
| 363 | "c" => 1 |
| 364 | ); |
| 365 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 366 | ##----------------------------------------------------------------------------## |
| 367 | # Main Logic. |
| 368 | ##----------------------------------------------------------------------------## |
| 369 | |
| 370 | my $Action = 'link'; |
| 371 | my @CompileOpts; |
| 372 | my @LinkOpts; |
| 373 | my @Files; |
| 374 | my $Lang; |
| 375 | my $Output; |
Ted Kremenek | a30730e | 2008-09-29 16:15:20 +0000 | [diff] [blame] | 376 | my %Uniqued; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 377 | |
| 378 | # Forward arguments to gcc. |
Ted Kremenek | f17ef3c | 2008-08-21 21:47:09 +0000 | [diff] [blame] | 379 | my $Status = system($CC,@ARGV); |
Ted Kremenek | cb344d0 | 2008-08-28 01:18:44 +0000 | [diff] [blame] | 380 | if ($Status) { exit($Status >> 8); } |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 381 | |
| 382 | # Get the analysis options. |
| 383 | my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'}; |
| 384 | if (!defined($Analyses)) { $Analyses = '-checker-cfref'; } |
| 385 | |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 386 | # Get the store model. |
| 387 | my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'}; |
Ted Kremenek | b8bb3e7 | 2009-09-25 05:55:59 +0000 | [diff] [blame] | 388 | if (!defined $StoreModel) { $StoreModel = "region"; } |
Ted Kremenek | be1fe1e | 2009-02-17 04:27:41 +0000 | [diff] [blame] | 389 | |
| 390 | # Get the constraints engine. |
| 391 | my $ConstraintsModel = $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'}; |
Ted Kremenek | 9f4ecb3 | 2009-02-20 21:49:22 +0000 | [diff] [blame] | 392 | if (!defined $ConstraintsModel) { $ConstraintsModel = "range"; } |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 393 | |
Ted Kremenek | db4f5f2 | 2008-11-04 00:02:53 +0000 | [diff] [blame] | 394 | # Get the output format. |
| 395 | my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'}; |
Ted Kremenek | 3891a15 | 2009-02-17 05:01:10 +0000 | [diff] [blame] | 396 | if (!defined $OutputFormat) { $OutputFormat = "html"; } |
Ted Kremenek | db4f5f2 | 2008-11-04 00:02:53 +0000 | [diff] [blame] | 397 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 398 | # Determine the level of verbosity. |
| 399 | my $Verbose = 0; |
| 400 | if (defined $ENV{CCC_ANALYZER_VERBOSE}) { $Verbose = 1; } |
| 401 | if (defined $ENV{CCC_ANALYZER_LOG}) { $Verbose = 2; } |
| 402 | |
Ted Kremenek | fd9df0e | 2009-05-09 19:19:28 +0000 | [diff] [blame] | 403 | # Determine what clang-cc executable to use. |
| 404 | my $ClangCC = $ENV{'CLANG_CC'}; |
| 405 | if (!defined $ClangCC) { $ClangCC = 'clang-cc'; } |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 406 | |
| 407 | # Get the HTML output directory. |
| 408 | my $HtmlDir = $ENV{'CCC_ANALYZER_HTML'}; |
| 409 | |
Ted Kremenek | 8459132 | 2009-02-24 22:07:12 +0000 | [diff] [blame] | 410 | my %DisabledArchs = ('ppc' => 1, 'ppc64' => 1); |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 411 | my %ArchsSeen; |
Ted Kremenek | 8459132 | 2009-02-24 22:07:12 +0000 | [diff] [blame] | 412 | my $HadArch = 0; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 413 | |
| 414 | # Process the arguments. |
| 415 | foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { |
Ted Kremenek | 89c4fcf | 2008-10-19 06:42:38 +0000 | [diff] [blame] | 416 | my $Arg = $ARGV[$i]; |
| 417 | my ($ArgKey) = split /=/,$Arg,2; |
| 418 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 419 | # Modes ccc-analyzer supports |
Ted Kremenek | d732a7b | 2009-08-04 00:57:12 +0000 | [diff] [blame] | 420 | if ($Arg =~ /^-(E|MM?)$/) { $Action = 'preprocess'; } |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 421 | elsif ($Arg eq '-c') { $Action = 'compile'; } |
| 422 | elsif ($Arg =~ /^-print-prog-name/) { exit 0; } |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 423 | |
| 424 | # Specially handle duplicate cases of -arch |
| 425 | if ($Arg eq "-arch") { |
| 426 | my $arch = $ARGV[$i+1]; |
Ted Kremenek | 8459132 | 2009-02-24 22:07:12 +0000 | [diff] [blame] | 427 | # We don't want to process 'ppc' because of Clang's lack of support |
| 428 | # for Altivec (also some #defines won't likely be defined correctly, etc.) |
| 429 | if (!(defined $DisabledArchs{$arch})) { $ArchsSeen{$arch} = 1; } |
| 430 | $HadArch = 1; |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 431 | ++$i; |
| 432 | next; |
| 433 | } |
| 434 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 435 | # Options with possible arguments that should pass through to compiler. |
Ted Kremenek | 89c4fcf | 2008-10-19 06:42:38 +0000 | [diff] [blame] | 436 | if (defined $CompileOptionMap{$ArgKey}) { |
| 437 | my $Cnt = $CompileOptionMap{$ArgKey}; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 438 | push @CompileOpts,$Arg; |
| 439 | while ($Cnt > 0) { ++$i; --$Cnt; push @CompileOpts, $ARGV[$i]; } |
| 440 | next; |
| 441 | } |
| 442 | |
| 443 | # Options with possible arguments that should pass through to linker. |
Ted Kremenek | 89c4fcf | 2008-10-19 06:42:38 +0000 | [diff] [blame] | 444 | if (defined $LinkerOptionMap{$ArgKey}) { |
| 445 | my $Cnt = $LinkerOptionMap{$ArgKey}; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 446 | push @LinkOpts,$Arg; |
| 447 | while ($Cnt > 0) { ++$i; --$Cnt; push @LinkOpts, $ARGV[$i]; } |
| 448 | next; |
| 449 | } |
| 450 | |
| 451 | # Options with possible arguments that should pass through to both compiler |
| 452 | # and the linker. |
Ted Kremenek | 89c4fcf | 2008-10-19 06:42:38 +0000 | [diff] [blame] | 453 | if (defined $CompilerLinkerOptionMap{$ArgKey}) { |
| 454 | my $Cnt = $CompilerLinkerOptionMap{$ArgKey}; |
Ted Kremenek | 47fc25f | 2008-09-29 23:06:09 +0000 | [diff] [blame] | 455 | |
Ted Kremenek | a30730e | 2008-09-29 16:15:20 +0000 | [diff] [blame] | 456 | # Check if this is an option that should have a unique value, and if so |
| 457 | # determine if the value was checked before. |
| 458 | if ($UniqueOptions{$Arg}) { |
| 459 | if (defined $Uniqued{$Arg}) { |
| 460 | $i += $Cnt; |
| 461 | next; |
| 462 | } |
| 463 | $Uniqued{$Arg} = 1; |
| 464 | } |
| 465 | |
Ted Kremenek | 47fc25f | 2008-09-29 23:06:09 +0000 | [diff] [blame] | 466 | push @CompileOpts,$Arg; |
| 467 | push @LinkOpts,$Arg; |
| 468 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 469 | while ($Cnt > 0) { |
| 470 | ++$i; --$Cnt; |
| 471 | push @CompileOpts, $ARGV[$i]; |
| 472 | push @LinkOpts, $ARGV[$i]; |
| 473 | } |
| 474 | next; |
| 475 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 476 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 477 | # Ignored options. |
Ted Kremenek | 89c4fcf | 2008-10-19 06:42:38 +0000 | [diff] [blame] | 478 | if (defined $IgnoredOptionMap{$ArgKey}) { |
| 479 | my $Cnt = $IgnoredOptionMap{$ArgKey}; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 480 | while ($Cnt > 0) { |
| 481 | ++$i; --$Cnt; |
| 482 | } |
| 483 | next; |
| 484 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 485 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 486 | # Compile mode flags. |
| 487 | if ($Arg =~ /^-[D,I,U](.*)$/) { |
| 488 | my $Tmp = $Arg; |
| 489 | if ($1 eq '') { |
| 490 | # FIXME: Check if we are going off the end. |
| 491 | ++$i; |
| 492 | $Tmp = $Arg . $ARGV[$i]; |
| 493 | } |
| 494 | push @CompileOpts,$Tmp; |
| 495 | next; |
| 496 | } |
| 497 | |
| 498 | # Language. |
| 499 | if ($Arg eq '-x') { |
| 500 | $Lang = $ARGV[$i+1]; |
| 501 | ++$i; next; |
| 502 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 503 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 504 | # Output file. |
| 505 | if ($Arg eq '-o') { |
| 506 | ++$i; |
| 507 | $Output = $ARGV[$i]; |
| 508 | next; |
| 509 | } |
| 510 | |
| 511 | # Get the link mode. |
| 512 | if ($Arg =~ /^-[l,L,O]/) { |
| 513 | if ($Arg eq '-O') { push @LinkOpts,'-O1'; } |
| 514 | elsif ($Arg eq '-Os') { push @LinkOpts,'-O2'; } |
| 515 | else { push @LinkOpts,$Arg; } |
| 516 | next; |
| 517 | } |
| 518 | |
| 519 | if ($Arg =~ /^-std=/) { |
| 520 | push @CompileOpts,$Arg; |
| 521 | next; |
| 522 | } |
| 523 | |
| 524 | # if ($Arg =~ /^-f/) { |
| 525 | # # FIXME: Not sure if the remaining -fxxxx options have no arguments. |
| 526 | # push @CompileOpts,$Arg; |
| 527 | # push @LinkOpts,$Arg; # FIXME: Not sure if these are link opts. |
| 528 | # } |
| 529 | |
| 530 | # Get the compiler/link mode. |
| 531 | if ($Arg =~ /^-F(.+)$/) { |
| 532 | my $Tmp = $Arg; |
| 533 | if ($1 eq '') { |
| 534 | # FIXME: Check if we are going off the end. |
| 535 | ++$i; |
| 536 | $Tmp = $Arg . $ARGV[$i]; |
| 537 | } |
| 538 | push @CompileOpts,$Tmp; |
| 539 | push @LinkOpts,$Tmp; |
| 540 | next; |
| 541 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 542 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 543 | # Input files. |
| 544 | if ($Arg eq '-filelist') { |
| 545 | # FIXME: Make sure we aren't walking off the end. |
| 546 | open(IN, $ARGV[$i+1]); |
| 547 | while (<IN>) { s/\015?\012//; push @Files,$_; } |
| 548 | close(IN); |
Ted Kremenek | 0895937 | 2009-08-14 18:20:50 +0000 | [diff] [blame] | 549 | ++$i; |
| 550 | next; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 551 | } |
| 552 | |
Ted Kremenek | 0895937 | 2009-08-14 18:20:50 +0000 | [diff] [blame] | 553 | # Handle -Wno-. We don't care about extra warnings, but |
| 554 | # we should suppress ones that we don't want to see. |
| 555 | if ($Arg =~ /^-Wno-/) { |
| 556 | push @CompileOpts, $Arg; |
| 557 | next; |
| 558 | } |
| 559 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 560 | if (!($Arg =~ /^-/)) { |
Ted Kremenek | 0895937 | 2009-08-14 18:20:50 +0000 | [diff] [blame] | 561 | push @Files, $Arg; |
| 562 | next; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 563 | } |
| 564 | } |
Ted Kremenek | 61cd988 | 2008-05-24 15:58:54 +0000 | [diff] [blame] | 565 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 566 | if ($Action eq 'compile' or $Action eq 'link') { |
Ted Kremenek | 8459132 | 2009-02-24 22:07:12 +0000 | [diff] [blame] | 567 | my @Archs = keys %ArchsSeen; |
| 568 | # Skip the file if we don't support the architectures specified. |
Ted Kremenek | 0e0eb8b | 2009-02-25 00:10:37 +0000 | [diff] [blame] | 569 | exit 0 if ($HadArch && scalar(@Archs) == 0); |
Ted Kremenek | 8459132 | 2009-02-24 22:07:12 +0000 | [diff] [blame] | 570 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 571 | foreach my $file (@Files) { |
| 572 | # Determine the language for the file. |
| 573 | my $FileLang = $Lang; |
| 574 | |
| 575 | if (!defined($FileLang)) { |
| 576 | # Infer the language from the extension. |
| 577 | if ($file =~ /[.]([^.]+)$/) { |
| 578 | $FileLang = $LangMap{$1}; |
| 579 | } |
| 580 | } |
Ted Kremenek | 1262fc4 | 2008-05-14 20:10:33 +0000 | [diff] [blame] | 581 | |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 582 | next if (!defined $FileLang); |
Ted Kremenek | efaf191 | 2009-05-11 21:08:34 +0000 | [diff] [blame] | 583 | next if (!defined $LangsAccepted{$FileLang}); |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 584 | |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 585 | my @CmdArgs; |
| 586 | my @AnalyzeArgs; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 587 | |
| 588 | if ($FileLang ne 'unknown') { |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 589 | push @CmdArgs,'-x'; |
| 590 | push @CmdArgs,$FileLang; |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 591 | } |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 592 | |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 593 | if (defined $StoreModel) { |
Ted Kremenek | be1fe1e | 2009-02-17 04:27:41 +0000 | [diff] [blame] | 594 | push @AnalyzeArgs, "-analyzer-store=$StoreModel"; |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 595 | } |
Ted Kremenek | be1fe1e | 2009-02-17 04:27:41 +0000 | [diff] [blame] | 596 | |
| 597 | if (defined $ConstraintsModel) { |
| 598 | push @AnalyzeArgs, "-analyzer-constraints=$ConstraintsModel"; |
| 599 | } |
| 600 | |
Ted Kremenek | db4f5f2 | 2008-11-04 00:02:53 +0000 | [diff] [blame] | 601 | if (defined $OutputFormat) { |
Ted Kremenek | be1fe1e | 2009-02-17 04:27:41 +0000 | [diff] [blame] | 602 | push @AnalyzeArgs, "-analyzer-output=" . $OutputFormat; |
Ted Kremenek | 7753b35 | 2009-07-27 22:10:34 +0000 | [diff] [blame] | 603 | if ($OutputFormat =~ /plist/) { |
Ted Kremenek | ddf32da | 2009-01-21 00:42:24 +0000 | [diff] [blame] | 604 | # Change "Output" to be a file. |
| 605 | my ($h, $f) = tempfile("report-XXXXXX", SUFFIX => ".plist", |
| 606 | DIR => $HtmlDir); |
| 607 | $ResultFile = $f; |
| 608 | $CleanupFile = $f; |
| 609 | } |
Ted Kremenek | db4f5f2 | 2008-11-04 00:02:53 +0000 | [diff] [blame] | 610 | } |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 611 | |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 612 | push @CmdArgs,@CompileOpts; |
| 613 | push @CmdArgs,$file; |
Zhongxing Xu | 07c3767 | 2008-10-27 14:26:32 +0000 | [diff] [blame] | 614 | |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 615 | if (scalar @Archs) { |
| 616 | foreach my $arch (@Archs) { |
| 617 | my @NewArgs; |
| 618 | push @NewArgs, '-arch'; |
| 619 | push @NewArgs, $arch; |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 620 | push @NewArgs, @CmdArgs; |
| 621 | Analyze($ClangCC, \@NewArgs, \@AnalyzeArgs, $FileLang, $Output, |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 622 | $Verbose, $HtmlDir, $file, $Analyses); |
| 623 | } |
| 624 | } |
| 625 | else { |
Ted Kremenek | 9a9e0d4 | 2009-05-15 04:20:31 +0000 | [diff] [blame] | 626 | Analyze($ClangCC, \@CmdArgs, \@AnalyzeArgs, $FileLang, $Output, |
Ted Kremenek | 27783eb | 2008-09-25 20:17:57 +0000 | [diff] [blame] | 627 | $Verbose, $HtmlDir, $file, $Analyses); |
| 628 | } |
Ted Kremenek | fbeeca8 | 2008-07-19 06:11:04 +0000 | [diff] [blame] | 629 | } |
| 630 | } |
Ted Kremenek | b098288 | 2008-03-25 22:35:32 +0000 | [diff] [blame] | 631 | |
Ted Kremenek | 948e06b | 2008-08-27 22:30:34 +0000 | [diff] [blame] | 632 | exit($Status >> 8); |
| 633 | |