gemma-2-9b-SBS / gemma.cpp /build /_deps /json-src /tests /thirdparty /Fuzzer /FuzzerExtFunctionsWeakAlias.cpp
| //===- FuzzerExtFunctionsWeakAlias.cpp - Interface to external functions --===// | |
| // | |
| // The LLVM Compiler Infrastructure | |
| // | |
| // This file is distributed under the University of Illinois Open Source | |
| // License. See LICENSE.TXT for details. | |
| // | |
| //===----------------------------------------------------------------------===// | |
| // Implementation using weak aliases. Works for Windows. | |
| //===----------------------------------------------------------------------===// | |
| using namespace fuzzer; | |
| extern "C" { | |
| // Declare these symbols as weak to allow them to be optionally defined. | |
| } | |
| template <typename T> | |
| static T *GetFnPtr(T *Fun, T *FunDef, const char *FnName, bool WarnIfMissing) { | |
| if (Fun == FunDef) { | |
| if (WarnIfMissing) | |
| Printf("WARNING: Failed to find function \"%s\".\n", FnName); | |
| return nullptr; | |
| } | |
| return Fun; | |
| } | |
| namespace fuzzer { | |
| ExternalFunctions::ExternalFunctions() { | |
| } | |
| } // namespace fuzzer | |