[cfe-commits] r54323 - /cfe/trunk/utils/scan-build
Ted Kremenek
kremenek at apple.com
Mon Aug 4 10:34:13 PDT 2008
Author: kremenek
Date: Mon Aug 4 12:34:06 2008
New Revision: 54323
URL: http://llvm.org/viewvc/llvm-project?rev=54323&view=rev
Log:
Convert remaining "open" calls to use three-argument form (thanks to Sam Bishop for the tip!).
Recognize 'ccc-analyzer' as a build command some users may use. Treat it just like calling gcc.
Modified:
cfe/trunk/utils/scan-build
Modified: cfe/trunk/utils/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/scan-build?rev=54323&r1=54322&r2=54323&view=diff
==============================================================================
--- cfe/trunk/utils/scan-build (original)
+++ cfe/trunk/utils/scan-build Mon Aug 4 12:34:06 2008
@@ -69,9 +69,9 @@
my %AvailableAnalyses;
# Query clang for analysis options.
-open(PIPE, "'$Clang' --help |") or
+open(PIPE, "-|", $Clang, "--help") or
DieDiag("Cannot execute '$Clang'");
-
+
my $FoundAnalysis = 0;
while(<PIPE>) {
@@ -210,15 +210,13 @@
# Use Digest::MD5. We don't have to be cryptographically secure. We're
# just looking for duplicate files that come from a non-malicious source.
# We use Digest::MD5 because it is a standard Perl module that should
- # come bundled on most systems.
-
+ # come bundled on most systems.
open(FILE, $FName) or DieDiag("Cannot open $FName when computing Digest.\n");
binmode FILE;
my $Result = Digest::MD5->new->addfile(*FILE)->hexdigest;
close(FILE);
- # Return the digest.
-
+ # Return the digest.
return $Result;
}
@@ -229,17 +227,14 @@
my $Prefix;
sub UpdatePrefix {
-
my $x = shift;
my $y = basename($x);
$x =~ s/\Q$y\E$//;
# Ignore /usr, /Library, /System, /Developer
-
return if ( $x =~ /^\/usr/ or $x =~ /^\/Library/
or $x =~ /^\/System/ or $x =~ /^\/Developer/);
-
if (!defined $Prefix) {
$Prefix = $x;
return;
@@ -260,15 +255,15 @@
my $fname = shift;
my $regex = shift;
my $newtext = shift;
-
+
open (RIN, $fname) or die "cannot open $fname";
- open (ROUT, ">$fname.tmp") or die "cannot open $fname.tmp";
-
+ open (ROUT, ">", "$fname.tmp") or die "cannot open $fname.tmp";
+
while (<RIN>) {
s/$regex/$newtext/;
print ROUT $_;
}
-
+
close (ROUT);
close (RIN);
system("mv", "$fname.tmp", $fname);
@@ -390,11 +385,9 @@
foreach my $file (@files) { ScanFile(\@Index, $Dir, $file); }
- # Generate an index.html file.
-
- my $FName = "$Dir/index.html";
-
- open(OUT, ">$FName") or DieDiag("Cannot create file '$FName'\n");
+ # Generate an index.html file.
+ my $FName = "$Dir/index.html";
+ open(OUT, ">", $FName) or DieDiag("Cannot create file '$FName'\n");
# Print out the header.
@@ -595,7 +588,8 @@
$Cmd = $1;
}
- if ($Cmd eq "gcc" or $Cmd eq "cc" or $Cmd eq "llvm-gcc") {
+ if ($Cmd eq "gcc" or $Cmd eq "cc" or $Cmd eq "llvm-gcc"
+ or $Cmd eq "ccc-analyzer") {
shift @$Args;
unshift @$Args, $CCAnalyzer;
}
More information about the cfe-commits
mailing list