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
llvm-svn: 289560
#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 {
// Cross over test inputs.
//===----------------------------------------------------------------------===//
-#include <cstring>
-
#include "FuzzerDefs.h"
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
+#include <cstring>
namespace fuzzer {
//===----------------------------------------------------------------------===//
// Basic definitions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_DEFS_H
#define LLVM_FUZZER_DEFS_H
inline uint64_t Bswap(uint64_t x) { return __builtin_bswap64(x); }
} // namespace fuzzer
+
#endif // LLVM_FUZZER_DEFS_H
} // namespace fuzzer
#endif // LLVM_FUZZER_DICTIONARY_H
-
#include "FuzzerIO.h"
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
-
#include <algorithm>
#include <atomic>
#include <chrono>
//===----------------------------------------------------------------------===//
// Defines an interface to (possibly optional) functions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_EXT_FUNCTIONS_H
#define LLVM_FUZZER_EXT_FUNCTIONS_H
#undef EXT_FUNC
};
} // namespace fuzzer
+
#endif
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_APPLE
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_LINUX
#undef EXT_FUNC
}
+
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS
#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>
//===----------------------------------------------------------------------===//
// IO functions.
//===----------------------------------------------------------------------===//
+
#include "FuzzerIO.h"
#include "FuzzerDefs.h"
#include "FuzzerExtFunctions.h"
#include <cstdarg>
#include <fstream>
#include <iterator>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
namespace fuzzer {
//===----------------------------------------------------------------------===//
// IO interface.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_IO_H
#define LLVM_FUZZER_IO_H
void DeleteFile(const std::string &Path);
} // namespace fuzzer
+
#endif // LLVM_FUZZER_IO_H
//===----------------------------------------------------------------------===//
// IO functions implementation using Posix API.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_POSIX
+
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include <cstdarg>
}
} // namespace fuzzer
+
#endif // LIBFUZZER_POSIX
//===----------------------------------------------------------------------===//
// IO functions implementation for Windows.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_WINDOWS
+
#include "FuzzerExtFunctions.h"
#include "FuzzerIO.h"
#include <cstdarg>
#include <fstream>
#include <io.h>
#include <iterator>
-#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <windows.h>
namespace fuzzer {
}
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS
#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 {
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
#include "FuzzerTracePC.h"
-
#include <algorithm>
#include <cstring>
#include <memory>
//===----------------------------------------------------------------------===//
// SHA1 utils.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_SHA1_H
#define LLVM_FUZZER_SHA1_H
std::string Hash(const Unit &U);
} // namespace fuzzer
+
#endif // LLVM_FUZZER_SHA1_H
#ifndef LLVM_FUZZER_TRACE_PC
#define LLVM_FUZZER_TRACE_PC
-#include <set>
-
#include "FuzzerDefs.h"
#include "FuzzerValueBitMap.h"
+#include <set>
namespace fuzzer {
//===----------------------------------------------------------------------===//
// Util functions.
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_FUZZER_UTIL_H
#define LLVM_FUZZER_UTIL_H
}
} // namespace fuzzer
+
#endif // LLVM_FUZZER_UTIL_H
//===----------------------------------------------------------------------===//
#include "FuzzerDefs.h"
#if LIBFUZZER_APPLE
+
#include "FuzzerIO.h"
#include <mutex>
#include <signal.h>
}
return ProcessStatus;
}
-}
+
+} // namespace fuzzer
+
#endif // LIBFUZZER_APPLE
//===----------------------------------------------------------------------===//
#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
//===----------------------------------------------------------------------===//
// Misc utils implementation using Posix API.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_POSIX
#include "FuzzerIO.h"
return memmem(Data, DataLen, Patt, PattLen);
}
-} // namespace fuzzer
+} // namespace fuzzer
+
#endif // LIBFUZZER_POSIX
//===----------------------------------------------------------------------===//
// Misc utils implementation for Windows.
//===----------------------------------------------------------------------===//
-
#include "FuzzerDefs.h"
#if LIBFUZZER_WINDOWS
#include "FuzzerIO.h"
}
} // namespace fuzzer
+
#endif // LIBFUZZER_WINDOWS