]> granicus.if.org Git - llvm/commitdiff
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
authorMarcos Pividori <mpividori@google.com>
Tue, 13 Dec 2016 17:46:11 +0000 (17:46 +0000)
committerMarcos Pividori <mpividori@google.com>
Tue, 13 Dec 2016 17:46:11 +0000 (17:46 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289560 91177308-0d34-0410-b5e6-96231b3b80d8

23 files changed:
lib/Fuzzer/FuzzerCorpus.h
lib/Fuzzer/FuzzerCrossOver.cpp
lib/Fuzzer/FuzzerDefs.h
lib/Fuzzer/FuzzerDictionary.h
lib/Fuzzer/FuzzerDriver.cpp
lib/Fuzzer/FuzzerExtFunctions.h
lib/Fuzzer/FuzzerExtFunctionsDlsym.cpp
lib/Fuzzer/FuzzerExtFunctionsWeak.cpp
lib/Fuzzer/FuzzerExtFunctionsWeakAlias.cpp
lib/Fuzzer/FuzzerFnAdapter.h
lib/Fuzzer/FuzzerIO.cpp
lib/Fuzzer/FuzzerIO.h
lib/Fuzzer/FuzzerIOPosix.cpp
lib/Fuzzer/FuzzerIOWindows.cpp
lib/Fuzzer/FuzzerInternal.h
lib/Fuzzer/FuzzerLoop.cpp
lib/Fuzzer/FuzzerSHA1.h
lib/Fuzzer/FuzzerTracePC.h
lib/Fuzzer/FuzzerUtil.h
lib/Fuzzer/FuzzerUtilDarwin.cpp
lib/Fuzzer/FuzzerUtilLinux.cpp
lib/Fuzzer/FuzzerUtilPosix.cpp
lib/Fuzzer/FuzzerUtilWindows.cpp

index bbe192f53f85698da3dfcc615ed1917a5c3bc199..88e83b320c471ac398d28fbf94290a9821f43637 100644 (file)
 #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 {
 
index e86e23f81f04c391345761a409c1860ebad3a5bb..8b0fd7d529a81205034f364985501bf1fac311b4 100644 (file)
@@ -9,11 +9,10 @@
 // Cross over test inputs.
 //===----------------------------------------------------------------------===//
 
-#include <cstring>
-
 #include "FuzzerDefs.h"
 #include "FuzzerMutate.h"
 #include "FuzzerRandom.h"
+#include <cstring>
 
 namespace fuzzer {
 
index 89d675ac1a44189580842578197cdb3c960566f1..a699045842b7dbbeeaf4eacd67a365f022a9b627 100644 (file)
@@ -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) { return __builtin_bswap32(x); }
 inline uint64_t Bswap(uint64_t x) { return __builtin_bswap64(x); }
 
 }  // namespace fuzzer
+
 #endif  // LLVM_FUZZER_DEFS_H
index b23b4b022e3cb54fb3408f28325c0a6e1e815690..eba0eabb6838144fcfe094cd8f46e222cee582a3 100644 (file)
@@ -122,4 +122,3 @@ bool ParseDictionaryFile(const std::string &Text, std::vector<Unit> *Units);
 }  // namespace fuzzer
 
 #endif  // LLVM_FUZZER_DICTIONARY_H
-
index f4f1a4d47d14f79d8853bba615ee54790988dfba..fb86cbc1efa36778c5a964514673709d282922f7 100644 (file)
@@ -15,7 +15,6 @@
 #include "FuzzerIO.h"
 #include "FuzzerMutate.h"
 #include "FuzzerRandom.h"
-
 #include <algorithm>
 #include <atomic>
 #include <chrono>
index 2ec86cb9231630bd08bcd9f912b1a6b20609e681..2672a385478d198f7069b2869e59c87e2ec82d1a 100644 (file)
@@ -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
index 65b0458dceefefc9c7d366415d80ccca34f5585c..06bddd5de38f3c709bd1c27519a020fc74cc754d 100644 (file)
@@ -46,5 +46,7 @@ ExternalFunctions::ExternalFunctions() {
 
 #undef EXT_FUNC
 }
+
 } // namespace fuzzer
+
 #endif // LIBFUZZER_APPLE
index cb3b31105d594a9219581c56abeef98c349aee86..7b02b6f0b701bddacb3c4c3d173e8594fe4ef591 100644 (file)
@@ -47,5 +47,7 @@ ExternalFunctions::ExternalFunctions() {
 
 #undef EXT_FUNC
 }
+
 } // namespace fuzzer
+
 #endif // LIBFUZZER_LINUX
index 3c42e539fcc36063f09a1f921dba82a12a6edd00..e10f7b4dcac20cfd415319b32986941018859667 100644 (file)
@@ -50,5 +50,7 @@ ExternalFunctions::ExternalFunctions() {
 
 #undef EXT_FUNC
 }
+
 } // namespace fuzzer
+
 #endif // LIBFUZZER_WINDOWS
index eb2c219b8703c4f3ac7ce903c6f399b0ad28fe1a..e53b628ed2110be310dba84d1725de1121acfd11 100644 (file)
 #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>
index 5d4d415d49e3e03aab97b1eb4162e272e59bf9e2..eda8e8772930001dc5ccdd6f221e5b8f2839263a 100644 (file)
@@ -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 {
 
index 39634f93feccd1504732382d21a4e9f38e7087e3..f5651cfe9ed14feb35e004b0d8615f5f964054e8 100644 (file)
@@ -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
index a4290face97cf1129e2c923d3c46a96d0993bd45..53a58f96287c44bd7359f79bc19c3bc9f5168e38 100644 (file)
@@ -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 &FileName) {
 }
 
 }  // namespace fuzzer
+
 #endif // LIBFUZZER_POSIX
index aaa2e34fb3591f63eb1bab61cd20315761b9091b..df530cdfbbc33accfcb013c00c570045ca5dc652 100644 (file)
@@ -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 &FileName) {
 }
 
 }  // namespace fuzzer
+
 #endif // LIBFUZZER_WINDOWS
index e3a1801b467d00e8b254aae82233ad9aee0e7095..f1e7415bb63afa45b7bd72972ad6cd65aca94a19 100644 (file)
 #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 {
 
index f96fc7416ff22cbe6d4ed0286048e36dd868ae24..93db6179e3d26245a06a959f3c93c63159bf15c8 100644 (file)
@@ -15,7 +15,6 @@
 #include "FuzzerMutate.h"
 #include "FuzzerRandom.h"
 #include "FuzzerTracePC.h"
-
 #include <algorithm>
 #include <cstring>
 #include <memory>
index b3e6111b474453c48e699154328481eac56c5bac..3b5e6e807f420b3fb3ffe432c80dd2efe96a8823 100644 (file)
@@ -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 Sha1[kSHA1NumBytes]);
 std::string Hash(const Unit &U);
 
 }  // namespace fuzzer
+
 #endif  // LLVM_FUZZER_SHA1_H
index acff27fd9db672e4a1454268c93e9c57b4cdc416..df037390c2afa921efa03199bf68ef01c899c560 100644 (file)
 #ifndef LLVM_FUZZER_TRACE_PC
 #define LLVM_FUZZER_TRACE_PC
 
-#include <set>
-
 #include "FuzzerDefs.h"
 #include "FuzzerValueBitMap.h"
+#include <set>
 
 namespace fuzzer {
 
index 78b7c2489b0de05988173fd11b78e227265ee874..08058c56e4c5e30867f3da949d1c27bd2579b89a 100644 (file)
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 // Util functions.
 //===----------------------------------------------------------------------===//
+
 #ifndef LLVM_FUZZER_UTIL_H
 #define LLVM_FUZZER_UTIL_H
 
@@ -67,4 +68,5 @@ inline std::string CloneArgsWithoutX(const std::vector<std::string> &Args,
 }
 
 }  // namespace fuzzer
+
 #endif  // LLVM_FUZZER_UTIL_H
index 62f0f2271fe172a65194f55c4d70071d30fe453d..9674368c355eee228bc62398a29ab9dff69728b7 100644 (file)
@@ -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 &Command) {
   }
   return ProcessStatus;
 }
-}
+
+} // namespace fuzzer
+
 #endif // LIBFUZZER_APPLE
index 060cec04542c2f9543e5b3314b1df1f99042fa77..dfe7e6f4e18a3ca0f2db427d75c6cfaefe2c9ea4 100644 (file)
 //===----------------------------------------------------------------------===//
 #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
index fc058cd72607f87ff6f888cf8d13b0f5eea8641c..8b484b8effa405ab800daa3bb15249c4ac0be345 100644 (file)
@@ -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 *Data, size_t DataLen, const void *Patt,
   return memmem(Data, DataLen, Patt, PattLen);
 }
 
-} // namespace fuzzer
+}  // namespace fuzzer
+
 #endif // LIBFUZZER_POSIX
index 91509cce8b5fd976e25fdd639d66b4b4b7ea409b..fea09a698b56e31bb2cb7e51184b13cd795bd832 100644 (file)
@@ -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 *Data, size_t DataLen, const void *Patt,
 }
 
 } // namespace fuzzer
+
 #endif // LIBFUZZER_WINDOWS