| 1 |
//===--------- OrcTestCommon.cpp - Utilities for Orc Unit Tests -----------===// |
| 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 |
// Common utilities for Orc unit tests. |
| 10 |
// |
| 11 |
//===----------------------------------------------------------------------===// |
| 12 |
|
| 13 |
#include "OrcTestCommon.h" |
| 14 |
|
| 15 |
using namespace llvm; |
| 16 |
|
| 17 |
bool OrcNativeTarget::NativeTargetInitialized = false; |
| 18 |
|
| 19 |
ModuleBuilder::ModuleBuilder(LLVMContext &Context, StringRef TripleStr, |
| 20 |
StringRef Name) |
| 21 |
: M(new Module(Name, Context)) { |
| 22 |
if (TripleStr != "") |
| 23 |
M->setTargetTriple(Triple(TripleStr)); |
| 24 |
} |
| 25 |
|
| 26 |
void llvm::orc::CoreAPIsBasedStandardTest::OverridableDispatcher::dispatch( |
| 27 |
std::unique_ptr<Task> T) { |
| 28 |
if (Parent.DispatchOverride) |
| 29 |
Parent.DispatchOverride(std::move(T)); |
| 30 |
else |
| 31 |
InPlaceTaskDispatcher::dispatch(std::move(T)); |
| 32 |
} |
| 33 |
|
| 34 |
std::unique_ptr<llvm::orc::ExecutorProcessControl> |
| 35 |
llvm::orc::CoreAPIsBasedStandardTest::makeEPC( |
| 36 |
std::shared_ptr<SymbolStringPool> SSP) { |
| 37 |
return std::make_unique<UnsupportedExecutorProcessControl>( |
| 38 |
std::move(SSP), std::make_unique<OverridableDispatcher>(*this)); |
| 39 |
} |