summaryrefslogtreecommitdiffstats
path: root/clang/tools
diff options
context:
space:
mode:
authorAnton Yartsev <anton.yartsev@gmail.com>2013-08-17 15:43:19 +0000
committerAnton Yartsev <anton.yartsev@gmail.com>2013-08-17 15:43:19 +0000
commit9ddb5fe2d79fefd06c4af7da8b61676ac59a1c79 (patch)
treee144fecdca03234fa1a2652d9aea71ef22412f69 /clang/tools
parent4e5a399b60c1f47020d5cb86e243b6e170cdd23d (diff)
downloadbcm5719-llvm-9ddb5fe2d79fefd06c4af7da8b61676ac59a1c79.tar.gz
bcm5719-llvm-9ddb5fe2d79fefd06c4af7da8b61676ac59a1c79.zip
+ make scan-build work with Strawberry Perl, ActiveState Perl, cygwin perl and msys perl ports.
llvm-svn: 188607
Diffstat (limited to 'clang/tools')
-rwxr-xr-xclang/tools/scan-build/scan-build19
1 files changed, 12 insertions, 7 deletions
diff --git a/clang/tools/scan-build/scan-build b/clang/tools/scan-build/scan-build
index 22d5289586a..82f0e837db8 100755
--- a/clang/tools/scan-build/scan-build
+++ b/clang/tools/scan-build/scan-build
@@ -32,7 +32,9 @@ my $TERM = $ENV{'TERM'};
my $UseColor = (defined $TERM and $TERM =~ 'xterm-.*color' and -t STDOUT
and defined $ENV{'SCAN_BUILD_COLOR'});
-my $UserName = HtmlEscape(getpwuid($<) || 'unknown');
+# Portability: getpwuid is not implemented for Win32 (see Perl language
+# reference, perlport), use getlogin instead.
+my $UserName = HtmlEscape(getlogin() || getpwuid($<) || 'unknown');
my $HostName = HtmlEscape(hostname() || 'unknown');
my $CurrentDir = HtmlEscape(getcwd());
my $CurrentDirSuffix = basename($CurrentDir);
@@ -121,8 +123,7 @@ sub GetHTMLRunDir {
my $Dir = shift @_;
my $TmpMode = 0;
if (!defined $Dir) {
- $Dir = $ENV{'TMPDIR'};
- if (!defined $Dir) { $Dir = "/tmp"; }
+ $Dir = $ENV{'TMPDIR'} || $ENV{'TEMP'} || $ENV{'TMP'} || "/tmp";
$TmpMode = 1;
}
@@ -1603,13 +1604,17 @@ my $AbsRealBin = Cwd::realpath($RealBin);
my $Cmd = "$AbsRealBin/libexec/ccc-analyzer";
my $CmdCXX = "$AbsRealBin/libexec/c++-analyzer";
-if (!defined $Cmd || ! -x $Cmd) {
+# Portability: use less strict but portable check -e (file exists) instead of
+# non-portable -x (file is executable). On some windows ports -x just checks
+# file extension to determine if a file is executable (see Perl language
+# reference, perlport)
+if (!defined $Cmd || ! -e $Cmd) {
$Cmd = "$AbsRealBin/ccc-analyzer";
- DieDiag("Executable 'ccc-analyzer' does not exist at '$Cmd'\n") if(! -x $Cmd);
+ DieDiag("'ccc-analyzer' does not exist at '$Cmd'\n") if(! -e $Cmd);
}
-if (!defined $CmdCXX || ! -x $CmdCXX) {
+if (!defined $CmdCXX || ! -e $CmdCXX) {
$CmdCXX = "$AbsRealBin/c++-analyzer";
- DieDiag("Executable 'c++-analyzer' does not exist at '$CmdCXX'\n") if(! -x $CmdCXX);
+ DieDiag("'c++-analyzer' does not exist at '$CmdCXX'\n") if(! -e $CmdCXX);
}
Diag("Using '$Clang' for static analysis\n");
OpenPOWER on IntegriCloud