FuzzerExtFunctions.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===- FuzzerExtFunctions.h - Interface to external functions ---*- C++ -* ===//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. // Defines an interface to (possibly optional) functions.
  9. //===----------------------------------------------------------------------===//
  10. #ifndef LLVM_FUZZER_EXT_FUNCTIONS_H
  11. #define LLVM_FUZZER_EXT_FUNCTIONS_H
  12. #include <stddef.h>
  13. #include <stdint.h>
  14. namespace fuzzer {
  15. struct ExternalFunctions {
  16. // Initialize function pointers. Functions that are not available will be set
  17. // to nullptr. Do not call this constructor before ``main()`` has been
  18. // entered.
  19. ExternalFunctions();
  20. #define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \
  21. RETURN_TYPE(*NAME) FUNC_SIG = nullptr
  22. #include "FuzzerExtFunctions.def"
  23. #undef EXT_FUNC
  24. };
  25. } // namespace fuzzer
  26. #endif