From: Aaron Ballman Date: Wed, 24 Jul 2019 20:03:27 +0000 (+0000) Subject: Fix exporting SARIF files from scan-build on Windows. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0c6c9f985a4af508325ae5018eb3b4af13d2410;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366941 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/scan-build/libexec/ccc-analyzer b/tools/scan-build/libexec/ccc-analyzer index 9a4548f167..277ed9f83a 100755 --- a/tools/scan-build/libexec/ccc-analyzer +++ b/tools/scan-build/libexec/ccc-analyzer @@ -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; } }