Author: aaronballman Date: Wed Jul 24 13:03:27 2019 New Revision: 366941 URL: http://llvm.org/viewvc/llvm-project?rev=366941&view=rev Log: 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. Modified: cfe/trunk/tools/scan-build/libexec/ccc-analyzer Modified: cfe/trunk/tools/scan-build/libexec/ccc-analyzer URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/libexec/ccc-analyzer?rev=366941&r1=366940&r2=366941&view=diff ============================================================================== --- cfe/trunk/tools/scan-build/libexec/ccc-analyzer (original) +++ cfe/trunk/tools/scan-build/libexec/ccc-analyzer Wed Jul 24 13:03:27 2019 @@ -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 ' 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; } } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits