[PATCH] D119495: [sanitizer] Check if directory exists before trying to create
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 11 11:57:49 PST 2022
tejohnson marked 2 inline comments as done.
tejohnson added a comment.
In D119495#3313173 <https://reviews.llvm.org/D119495#3313173>, @vitalybuka wrote:
> it would be nice to have unittests:
> TEST(SanitizerCommon, FileExists)
> TEST(SanitizerCommon, DirExists)
> TEST(SanitizerCommon, RecursiveCreateParentDirs)
With D109794 <https://reviews.llvm.org/D109794> I added TEST(SanitizerCommon, ReportFile) which does test RecursiveCreateParentDirs. Since RecursiveCreateParentDirs is a static function I can't call it directly from the unit tests.
I've added the FileExists and DirExists unit tests, however.
================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_win.cpp:93
bool FileExists(const char *filename) {
return ::GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES;
}
----------------
vitalybuka wrote:
> hm looks like existing code is wrong
Yeah that's what I thought too. I didn't want to change that part of the existing behavior, however, since it doesn't seem to be causing an issue.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119495/new/
https://reviews.llvm.org/D119495
More information about the llvm-commits
mailing list