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