diff options
author | Marcos Pividori <mpividori@google.com> | 2016-12-13 17:46:40 +0000 |
---|---|---|
committer | Marcos Pividori <mpividori@google.com> | 2016-12-13 17:46:40 +0000 |
commit | 7c1defd73801ca7e37d27d01fbcb576e86699850 (patch) | |
tree | b1c394da5583e405a17c4aa6e0c3b039eee53862 /llvm/lib | |
parent | 67dfacdd80791984a11d5ce3a4df8dad3043ed8f (diff) | |
download | bcm5719-llvm-7c1defd73801ca7e37d27d01fbcb576e86699850.tar.gz bcm5719-llvm-7c1defd73801ca7e37d27d01fbcb576e86699850.zip |
[libFuzzer] Avoid name collision with Windows API.
Windows uses some macros to replace DeleteFile() by DeleteFileA() or
DeleteFileW(). This was causing an error at link time.
DeleteFile was renamed to RemoveFile().
Differential Revision: https://reviews.llvm.org/D27577
llvm-svn: 289563
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerCorpus.h | 2 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerIO.h | 2 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerIOPosix.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerIOWindows.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Fuzzer/FuzzerMerge.cpp | 4 |
5 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Fuzzer/FuzzerCorpus.h b/llvm/lib/Fuzzer/FuzzerCorpus.h index 88e83b320c4..663c5854b4c 100644 --- a/llvm/lib/Fuzzer/FuzzerCorpus.h +++ b/llvm/lib/Fuzzer/FuzzerCorpus.h @@ -119,7 +119,7 @@ class InputCorpus { void DeleteInput(size_t Idx) { InputInfo &II = *Inputs[Idx]; if (!OutputCorpus.empty() && II.MayDeleteFile) - DeleteFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1))); + RemoveFile(DirPlusFile(OutputCorpus, Sha1ToString(II.Sha1))); Unit().swap(II.U); if (FeatureDebug) Printf("EVICTED %zd\n", Idx); diff --git a/llvm/lib/Fuzzer/FuzzerIO.h b/llvm/lib/Fuzzer/FuzzerIO.h index f5651cfe9ed..741fecf415b 100644 --- a/llvm/lib/Fuzzer/FuzzerIO.h +++ b/llvm/lib/Fuzzer/FuzzerIO.h @@ -57,7 +57,7 @@ int CloseFile(int Fd); int DuplicateFile(int Fd); -void DeleteFile(const std::string &Path); +void RemoveFile(const std::string &Path); } // namespace fuzzer diff --git a/llvm/lib/Fuzzer/FuzzerIOPosix.cpp b/llvm/lib/Fuzzer/FuzzerIOPosix.cpp index 53a58f96287..720bc130459 100644 --- a/llvm/lib/Fuzzer/FuzzerIOPosix.cpp +++ b/llvm/lib/Fuzzer/FuzzerIOPosix.cpp @@ -71,7 +71,7 @@ int DuplicateFile(int Fd) { return dup(Fd); } -void DeleteFile(const std::string &Path) { +void RemoveFile(const std::string &Path) { unlink(Path.c_str()); } diff --git a/llvm/lib/Fuzzer/FuzzerIOWindows.cpp b/llvm/lib/Fuzzer/FuzzerIOWindows.cpp index dd36d0632bb..a4738eb9dfe 100644 --- a/llvm/lib/Fuzzer/FuzzerIOWindows.cpp +++ b/llvm/lib/Fuzzer/FuzzerIOWindows.cpp @@ -135,7 +135,7 @@ int DuplicateFile(int Fd) { return _dup(Fd); } -void DeleteFile(const std::string &Path) { +void RemoveFile(const std::string &Path) { _unlink(Path.c_str()); } diff --git a/llvm/lib/Fuzzer/FuzzerMerge.cpp b/llvm/lib/Fuzzer/FuzzerMerge.cpp index 21f15998330..72f171e7e41 100644 --- a/llvm/lib/Fuzzer/FuzzerMerge.cpp +++ b/llvm/lib/Fuzzer/FuzzerMerge.cpp @@ -221,7 +221,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args, std::string CFPath = "libFuzzerTemp." + std::to_string(GetPid()) + ".txt"; // Write the control file. - DeleteFile(CFPath); + RemoveFile(CFPath); std::ofstream ControlFile(CFPath); ControlFile << AllFiles.size() << "\n"; ControlFile << NumFilesInFirstCorpus << "\n"; @@ -253,7 +253,7 @@ void Fuzzer::CrashResistantMerge(const std::vector<std::string> &Args, for (auto &F: NewFiles) WriteToOutputCorpus(FileToVector(F)); // We are done, delete the control file. - DeleteFile(CFPath); + RemoveFile(CFPath); } } // namespace fuzzer |