#include "llvm-c/Core.h"
#include "llvm-c/Error.h"
#include "llvm-c/LLJIT.h"
#include "llvm-c/LLJITUtils.h"
#include "llvm-c/Orc.h"
#include "gtest/gtest.h"
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
#include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IRReader/IRReader.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Testing/Support/Error.h"
#include <string>
usingnamespacellvm;
usingnamespacellvm::orc;
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(…)
class OrcCAPITestBase : public testing::Test { … };
std::string OrcCAPITestBase::TargetTriple;
bool OrcCAPITestBase::TargetSupported = …;
namespace {
constexpr StringRef SumExample = …;
constexpr StringRef SumDebugExample = …;
}
static std::string toString(LLVMErrorRef E) { … }
TEST_F(OrcCAPITestBase, SymbolStringPoolUniquing) { … }
TEST_F(OrcCAPITestBase, JITDylibLookup) { … }
TEST_F(OrcCAPITestBase, MaterializationUnitCreation) { … }
struct ExecutionSessionLookupHelper { … };
static void executionSessionLookupHandlerCallback(LLVMErrorRef Err,
LLVMOrcCSymbolMapPairs Result,
size_t NumPairs,
void *RawCtx) { … }
TEST_F(OrcCAPITestBase, ExecutionSessionLookup_Success) { … }
TEST_F(OrcCAPITestBase, ExecutionSessionLookup_Failure) { … }
TEST_F(OrcCAPITestBase, DefinitionGenerators) { … }
#if defined(_AIX)
TEST_F(OrcCAPITestBase, DISABLED_ResourceTrackerDefinitionLifetime) {
#else
TEST_F(OrcCAPITestBase, ResourceTrackerDefinitionLifetime) { … }
#if defined(_AIX)
TEST_F(OrcCAPITestBase, DISABLED_ResourceTrackerTransfer) {
#else
TEST_F(OrcCAPITestBase, ResourceTrackerTransfer) { … }
#if defined(_AIX)
TEST_F(OrcCAPITestBase, DISABLED_AddObjectBuffer) {
#else
TEST_F(OrcCAPITestBase, AddObjectBuffer) { … }
extern "C" struct jit_descriptor __jit_debug_descriptor;
static void *findLastDebugDescriptorEntryPtr() { … }
#if defined(_AIX) or not(defined(__ELF__) or defined(__MACH__))
TEST_F(OrcCAPITestBase, DISABLED_EnableDebugSupport) {
#else
static LLVM_ATTRIBUTE_USED void linkComponents() { … }
TEST_F(OrcCAPITestBase, EnableDebugSupport) { … }
#if defined(_AIX)
TEST_F(OrcCAPITestBase, DISABLED_ExecutionTest) {
#else
TEST_F(OrcCAPITestBase, ExecutionTest) { … }
void Destroy(void *Ctx) { … }
void TargetFn() { … }
void Materialize(void *Ctx, LLVMOrcMaterializationResponsibilityRef MR) { … }
TEST_F(OrcCAPITestBase, MaterializationResponsibility) { … }
struct SuspendedLookupContext { … };
static LLVMErrorRef TryToGenerateWithSuspendedLookup(
LLVMOrcDefinitionGeneratorRef GeneratorObj, void *RawCtx,
LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind,
LLVMOrcJITDylibRef JD, LLVMOrcJITDylibLookupFlags JDLookupFlags,
LLVMOrcCLookupSet LookupSet, size_t LookupSetSize) { … }
static void DisposeSuspendedLookupContext(void *Ctx) { … }
static void
suspendLookupTestLookupHandlerCallback(LLVMErrorRef Err,
LLVMOrcCSymbolMapPairs Result,
size_t NumPairs, void *RawCtx) { … }
TEST_F(OrcCAPITestBase, SuspendedLookup) { … }