Fix exporting SARIF files from scan-build on Windows.

In Perl, -z is defined as checking if a "file has zero size" and makes no mention what it does when given a directory. It looks like the behavior differs across platforms, which is why on Windows the SARIF file was always being deleted.

Patch by Joe Ranieri.

llvm-svn: 366941
This commit is contained in:
Aaron Ballman 2019-07-24 20:03:27 +00:00
parent ff4b515a77
commit 70964d42ea
1 changed files with 2 additions and 2 deletions

View File

@ -118,7 +118,7 @@ my $ResultFile;
# Remove any stale files at exit.
END {
if (defined $ResultFile && -z $ResultFile) {
if (defined $ResultFile && $ResultFile ne "") {
unlink($ResultFile);
}
if (defined $CleanupFile) {
@ -752,7 +752,7 @@ if ($Action eq 'compile' or $Action eq 'link') {
DIR => $HtmlDir);
$ResultFile = $f;
# If the HtmlDir is not set, we should clean up the plist files.
if (!defined $HtmlDir || -z $HtmlDir) {
if (!defined $HtmlDir || $HtmlDir eq "") {
$CleanupFile = $f;
}
}