1 //===---------------------- ExecuteFunction.h -------------------*- 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 9 #ifndef LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H 10 #define LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H 11 12 namespace __llvm_libc { 13 namespace testutils { 14 15 class FunctionCaller { 16 public: 17 virtual ~FunctionCaller() {} 18 virtual void operator()() = 0; 19 }; 20 21 struct ProcessStatus { 22 int PlatformDefined; 23 24 bool exitedNormally(); 25 int getExitCode(); 26 int getFatalSignal(); 27 }; 28 29 ProcessStatus invokeInSubprocess(FunctionCaller *Func); 30 31 const char *signalAsString(int Signum); 32 33 } // namespace testutils 34 } // namespace __llvm_libc 35 36 #endif // LLVM_LIBC_UTILS_TESTUTILS_EXECUTEFUNCTION_H 37