[llvm] r289560 - [libFuzzer] Clean up headers and file formatting of LibFuzzer files.
Marcos Pividori via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 09:46:11 PST 2016
Author: mpividori
Date: Tue Dec 13 11:46:11 2016
New Revision: 289560
URL: http://llvm.org/viewvc/llvm-project?rev=289560&view=rev
Log:
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
Reorganize #includes to follow LLVM Coding Standards.
Include some missing headers. Required to use `Printf()`.
Aside from that, this patch contains no functional change.
It is purely a re-organization.
Differential Revision: https://reviews.llvm.org/D27363
Modified:
llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp
llvm/trunk/lib/Fuzzer/FuzzerDefs.h
llvm/trunk/lib/Fuzzer/FuzzerDictionary.h
llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.h
llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp
llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp
llvm/trunk/lib/Fuzzer/FuzzerFnAdapter.h
llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
llvm/trunk/lib/Fuzzer/FuzzerIO.h
llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
llvm/trunk/lib/Fuzzer/FuzzerInternal.h
llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
llvm/trunk/lib/Fuzzer/FuzzerSHA1.h
llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
llvm/trunk/lib/Fuzzer/FuzzerUtil.h
llvm/trunk/lib/Fuzzer/FuzzerUtilDarwin.cpp
llvm/trunk/lib/Fuzzer/FuzzerUtilLinux.cpp
llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
Modified: llvm/trunk/lib/Fuzzer/FuzzerCorpus.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerCorpus.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerCorpus.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerCorpus.h Tue Dec 13 11:46:11 2016
@@ -12,14 +12,14 @@
#ifndef LLVM_FUZZER_CORPUS
#define LLVM_FUZZER_CORPUS
-#include <random>
-#include <unordered_set>
-
#include "FuzzerDefs.h"
#include "FuzzerIO.h"
#include "FuzzerRandom.h"
#include "FuzzerSHA1.h"
#include "FuzzerTracePC.h"
+#include <numeric>
+#include <random>
+#include <unordered_set>
namespace fuzzer {
Modified: llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerCrossOver.cpp Tue Dec 13 11:46:11 2016
@@ -9,11 +9,10 @@
// Cross over test inputs.
//===----------------------------------------------------------------------===//
-#include <cstring>
-
#include "FuzzerDefs.h"
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
+#include <cstring>
namespace fuzzer {
Modified: llvm/trunk/lib/Fuzzer/FuzzerDefs.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDefs.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDefs.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDefs.h Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// Basic definitions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_DEFS_H
#define LLVM_FUZZER_DEFS_H
@@ -77,4 +78,5 @@ inline uint32_t Bswap(uint32_t x) { retu
inline uint64_t Bswap(uint64_t x) { return __builtin_bswap64(x); }
} // namespace fuzzer
+
#endif // LLVM_FUZZER_DEFS_H
Modified: llvm/trunk/lib/Fuzzer/FuzzerDictionary.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDictionary.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDictionary.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDictionary.h Tue Dec 13 11:46:11 2016
@@ -122,4 +122,3 @@ bool ParseDictionaryFile(const std::stri
} // namespace fuzzer
#endif // LLVM_FUZZER_DICTIONARY_H
-
Modified: llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerDriver.cpp Tue Dec 13 11:46:11 2016
@@ -15,7 +15,6 @@
#include "FuzzerIO.h"
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
-
#include <algorithm>
#include <atomic>
#include <chrono>
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctions.h Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// Defines an interface to (possibly optional) functions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_EXT_FUNCTIONS_H
#define LLVM_FUZZER_EXT_FUNCTIONS_H
@@ -30,4 +31,5 @@ struct ExternalFunctions {
#undef EXT_FUNC
};
} // namespace fuzzer
+
#endif
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp Tue Dec 13 11:46:11 2016
@@ -46,5 +46,7 @@ ExternalFunctions::ExternalFunctions() {
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_APPLE
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeak.cpp Tue Dec 13 11:46:11 2016
@@ -47,5 +47,7 @@ ExternalFunctions::ExternalFunctions() {
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_LINUX
Modified: llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp Tue Dec 13 11:46:11 2016
@@ -50,5 +50,7 @@ ExternalFunctions::ExternalFunctions() {
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS
Modified: llvm/trunk/lib/Fuzzer/FuzzerFnAdapter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerFnAdapter.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerFnAdapter.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerFnAdapter.h Tue Dec 13 11:46:11 2016
@@ -15,10 +15,9 @@
#ifndef LLVM_FUZZER_ADAPTER_H
#define LLVM_FUZZER_ADAPTER_H
+#include <algorithm>
#include <stddef.h>
#include <stdint.h>
-
-#include <algorithm>
#include <string>
#include <tuple>
#include <vector>
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.cpp Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// IO functions.
//===----------------------------------------------------------------------===//
+
#include "FuzzerIO.h"
#include "FuzzerDefs.h"
#include "FuzzerExtFunctions.h"
@@ -15,8 +16,8 @@
#include <cstdarg>
#include <fstream>
#include <iterator>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
namespace fuzzer {
Modified: llvm/trunk/lib/Fuzzer/FuzzerIO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIO.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIO.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIO.h Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// IO interface.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_IO_H
#define LLVM_FUZZER_IO_H
@@ -59,4 +60,5 @@ int DuplicateFile(int Fd);
void DeleteFile(const std::string &Path);
} // namespace fuzzer
+
#endif // LLVM_FUZZER_IO_H
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOPosix.cpp Tue Dec 13 11:46:11 2016
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
// IO functions implementation using Posix API.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_POSIX
+
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include <cstdarg>
@@ -84,4 +84,5 @@ std::string DirName(const std::string &F
}
} // namespace fuzzer
+
#endif // LIBFUZZER_POSIX
Modified: llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerIOWindows.cpp Tue Dec 13 11:46:11 2016
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
// IO functions implementation for Windows.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_WINDOWS
+
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include <cstdarg>
@@ -18,8 +18,8 @@
#include <fstream>
#include <io.h>
#include <iterator>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <windows.h>
namespace fuzzer {
@@ -144,4 +144,5 @@ std::string DirName(const std::string &F
}
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS
Modified: llvm/trunk/lib/Fuzzer/FuzzerInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerInternal.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerInternal.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerInternal.h Tue Dec 13 11:46:11 2016
@@ -12,19 +12,18 @@
#ifndef LLVM_FUZZER_INTERNAL_H
#define LLVM_FUZZER_INTERNAL_H
-#include <algorithm>
-#include <atomic>
-#include <chrono>
-#include <climits>
-#include <cstdlib>
-#include <string.h>
-
#include "FuzzerDefs.h"
#include "FuzzerExtFunctions.h"
#include "FuzzerInterface.h"
#include "FuzzerOptions.h"
#include "FuzzerSHA1.h"
#include "FuzzerValueBitMap.h"
+#include <algorithm>
+#include <atomic>
+#include <chrono>
+#include <climits>
+#include <cstdlib>
+#include <string.h>
namespace fuzzer {
Modified: llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerLoop.cpp Tue Dec 13 11:46:11 2016
@@ -15,7 +15,6 @@
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
#include "FuzzerTracePC.h"
-
#include <algorithm>
#include <cstring>
#include <memory>
Modified: llvm/trunk/lib/Fuzzer/FuzzerSHA1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerSHA1.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerSHA1.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerSHA1.h Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// SHA1 utils.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_SHA1_H
#define LLVM_FUZZER_SHA1_H
@@ -28,4 +29,5 @@ std::string Sha1ToString(const uint8_t S
std::string Hash(const Unit &U);
} // namespace fuzzer
+
#endif // LLVM_FUZZER_SHA1_H
Modified: llvm/trunk/lib/Fuzzer/FuzzerTracePC.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerTracePC.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerTracePC.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerTracePC.h Tue Dec 13 11:46:11 2016
@@ -12,10 +12,9 @@
#ifndef LLVM_FUZZER_TRACE_PC
#define LLVM_FUZZER_TRACE_PC
-#include <set>
-
#include "FuzzerDefs.h"
#include "FuzzerValueBitMap.h"
+#include <set>
namespace fuzzer {
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtil.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtil.h?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtil.h (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtil.h Tue Dec 13 11:46:11 2016
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
// Util functions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_UTIL_H
#define LLVM_FUZZER_UTIL_H
@@ -67,4 +68,5 @@ inline std::string CloneArgsWithoutX(con
}
} // namespace fuzzer
+
#endif // LLVM_FUZZER_UTIL_H
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtilDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtilDarwin.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilDarwin.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilDarwin.cpp Tue Dec 13 11:46:11 2016
@@ -10,6 +10,7 @@
//===----------------------------------------------------------------------===//
#include "FuzzerDefs.h"
#if LIBFUZZER_APPLE
+
#include "FuzzerIO.h"
#include <mutex>
#include <signal.h>
@@ -145,5 +146,7 @@ int ExecuteCommand(const std::string &Co
}
return ProcessStatus;
}
-}
+
+} // namespace fuzzer
+
#endif // LIBFUZZER_APPLE
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtilLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtilLinux.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilLinux.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilLinux.cpp Tue Dec 13 11:46:11 2016
@@ -10,10 +10,15 @@
//===----------------------------------------------------------------------===//
#include "FuzzerDefs.h"
#if LIBFUZZER_LINUX
+
#include <stdlib.h>
+
namespace fuzzer {
+
int ExecuteCommand(const std::string &Command) {
return system(Command.c_str());
}
-}
+
+} // namespace fuzzer
+
#endif // LIBFUZZER_LINUX
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilPosix.cpp Tue Dec 13 11:46:11 2016
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// Misc utils implementation using Posix API.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_POSIX
#include "FuzzerIO.h"
@@ -113,5 +112,6 @@ const void *SearchMemory(const void *Dat
return memmem(Data, DataLen, Patt, PattLen);
}
-} // namespace fuzzer
+} // namespace fuzzer
+
#endif // LIBFUZZER_POSIX
Modified: llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp?rev=289560&r1=289559&r2=289560&view=diff
==============================================================================
--- llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp (original)
+++ llvm/trunk/lib/Fuzzer/FuzzerUtilWindows.cpp Tue Dec 13 11:46:11 2016
@@ -8,7 +8,6 @@
//===----------------------------------------------------------------------===//
// Misc utils implementation for Windows.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_WINDOWS
#include "FuzzerIO.h"
@@ -179,4 +178,5 @@ const void *SearchMemory(const void *Dat
}
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS
More information about the llvm-commits
mailing list