1 //===-- TargetExecutionUtils.h - Utils for execution in target --*- 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 // Utilities for execution in the target process.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
14 #define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
15 
16 #include "llvm/ADT/ArrayRef.h"
17 #include "llvm/ADT/Optional.h"
18 #include "llvm/ADT/StringRef.h"
19 #include <string>
20 
21 namespace llvm {
22 namespace orc {
23 
24 /// Run a main function, returning the result.
25 ///
26 /// If the optional ProgramName argument is given then it will be inserted
27 /// before the strings in Args as the first argument to the called function.
28 ///
29 /// It is legal to have an empty argument list and no program name, however
30 /// many main functions will expect a name argument at least, and will fail
31 /// if none is provided.
32 int runAsMain(int (*Main)(int, char *[]), ArrayRef<std::string> Args,
33               Optional<StringRef> ProgramName = None);
34 
35 } // end namespace orc
36 } // end namespace llvm
37 
38 #endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_TARGETEXECUTIONUTILS_H
39