[compiler-rt] r334152 - [sanitizer] Don't use internal_unlink on Windows
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 6 17:26:06 PDT 2018
Author: vitalybuka
Date: Wed Jun 6 17:26:06 2018
New Revision: 334152
URL: http://llvm.org/viewvc/llvm-project?rev=334152&view=rev
Log:
[sanitizer] Don't use internal_unlink on Windows
Modified:
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc?rev=334152&r1=334151&r2=334152&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_libc_test.cc Wed Jun 6 17:26:06 2018
@@ -88,6 +88,16 @@ static void temp_file_name(char *buf, si
#endif
}
+static void Unlink(const char *path) {
+#if SANITIZER_WINDOWS
+ // No sanitizer needs to delete a file on Windows yet. If we ever do, we can
+ // add a portable wrapper and test it from here.
+ ::DeleteFileA(&path[0]);
+#else
+ internal_unlink(path);
+#endif
+}
+
TEST(SanitizerCommon, FileOps) {
const char *str1 = "qwerty";
uptr len1 = internal_strlen(str1);
@@ -143,13 +153,7 @@ TEST(SanitizerCommon, FileOps) {
EXPECT_EQ(0, internal_memcmp(buf, str2, len2));
CloseFile(fd);
-#if SANITIZER_WINDOWS
- // No sanitizer needs to delete a file on Windows yet. If we ever do, we can
- // add a portable wrapper and test it from here.
- ::DeleteFileA(&tmpfile[0]);
-#else
- internal_unlink(tmpfile);
-#endif
+ Unlink(tmpfile);
}
class SanitizerCommonFileTest : public ::testing::TestWithParam<uptr> {
@@ -167,7 +171,7 @@ class SanitizerCommonFileTest : public :
f.write(data_.data(), data_.size());
}
- void TearDown() override { internal_unlink(file_name_); }
+ void TearDown() override { Unlink(file_name_); }
protected:
char file_name_[256];
More information about the llvm-commits
mailing list