1c5f01b2fSopenharmony_ci//===- FuzzerExtFunctions.h - Interface to external functions ---*- C++ -* ===// 2c5f01b2fSopenharmony_ci// 3c5f01b2fSopenharmony_ci// The LLVM Compiler Infrastructure 4c5f01b2fSopenharmony_ci// 5c5f01b2fSopenharmony_ci// This file is distributed under the University of Illinois Open Source 6c5f01b2fSopenharmony_ci// License. See LICENSE.TXT for details. 7c5f01b2fSopenharmony_ci// 8c5f01b2fSopenharmony_ci//===----------------------------------------------------------------------===// 9c5f01b2fSopenharmony_ci// Defines an interface to (possibly optional) functions. 10c5f01b2fSopenharmony_ci//===----------------------------------------------------------------------===// 11c5f01b2fSopenharmony_ci 12c5f01b2fSopenharmony_ci#ifndef LLVM_FUZZER_EXT_FUNCTIONS_H 13c5f01b2fSopenharmony_ci#define LLVM_FUZZER_EXT_FUNCTIONS_H 14c5f01b2fSopenharmony_ci 15c5f01b2fSopenharmony_ci#include <stddef.h> 16c5f01b2fSopenharmony_ci#include <stdint.h> 17c5f01b2fSopenharmony_ci 18c5f01b2fSopenharmony_cinamespace fuzzer { 19c5f01b2fSopenharmony_ci 20c5f01b2fSopenharmony_cistruct ExternalFunctions { 21c5f01b2fSopenharmony_ci // Initialize function pointers. Functions that are not available will be set 22c5f01b2fSopenharmony_ci // to nullptr. Do not call this constructor before ``main()`` has been 23c5f01b2fSopenharmony_ci // entered. 24c5f01b2fSopenharmony_ci ExternalFunctions(); 25c5f01b2fSopenharmony_ci 26c5f01b2fSopenharmony_ci#define EXT_FUNC(NAME, RETURN_TYPE, FUNC_SIG, WARN) \ 27c5f01b2fSopenharmony_ci RETURN_TYPE(*NAME) FUNC_SIG = nullptr 28c5f01b2fSopenharmony_ci 29c5f01b2fSopenharmony_ci#include "FuzzerExtFunctions.def" 30c5f01b2fSopenharmony_ci 31c5f01b2fSopenharmony_ci#undef EXT_FUNC 32c5f01b2fSopenharmony_ci}; 33c5f01b2fSopenharmony_ci} // namespace fuzzer 34c5f01b2fSopenharmony_ci 35c5f01b2fSopenharmony_ci#endif 36