[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
This commit is contained in:
Marcos Pividori 2016-12-13 17:46:40 +00:00
parent 67dfacdd80
commit 7c1defd738
5 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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

View File

@ -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());
}

View File

@ -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());
}

View File

@ -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