[llvm] r289563 - [libFuzzer] Avoid name collision with Windows API.
Marcos Pividori via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 09:46:41 PST 2016
Author: mpividori
Date: Tue Dec 13 11:46:40 2016
New Revision: 289563
URL: http://llvm.org/viewvc/llvm-project?rev=289563&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
llvm/trunk/lib/Fuzzer/FuzzerIO.h
llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerCorpus.h?rev=289563&r1=289562&r2=289563&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerCorpus.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerCorpus.h Tue Dec 13 11:46:40 2016
@@ -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);
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.h?rev=289563&r1=289562&r2=289563&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.h Tue Dec 13 11:46:40 2016
@@ -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
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp?rev=289563&r1=289562&r2=289563&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp Tue Dec 13 11:46:40 2016
@@ -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());
}
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp?rev=289563&r1=289562&r2=289563&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp Tue Dec 13 11:46:40 2016
@@ -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());
}
Modified: llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp?rev=289563&r1=289562&r2=289563&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerMerge.cpp Tue Dec 13 11:46:40 2016
@@ -221,7 +221,7 @@ void Fuzzer::CrashResistantMerge(const s
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 s
for (auto &F: NewFiles)
WriteToOutputCorpus(FileToVector(F));
// We are done, delete the control file.
- DeleteFile(CFPath);
+ RemoveFile(CFPath);
}
} // namespace fuzzer
More information about the llvm-commits
mailing list