Revert r351138 "[ORC] Move ORC Core symbol map and set types into their own

header: CoreTypes.h."

This commit broke some bots. Reverting while I investigate.

llvm-svn: 351195
This commit is contained in:
Lang Hames 2019-01-15 15:21:13 +00:00
parent eb60fbfdb4
commit 199a00c3a2
5 changed files with 347 additions and 411 deletions

View File

@ -15,11 +15,13 @@
#define LLVM_EXECUTIONENGINE_ORC_CORE_H
#include "llvm/ADT/BitmaskEnum.h"
#include "llvm/ExecutionEngine/Orc/CoreTypes.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include <memory>
#include <vector>
#define DEBUG_TYPE "orc"
@ -33,6 +35,116 @@ class MaterializationUnit;
class MaterializationResponsibility;
class JITDylib;
/// VModuleKey provides a unique identifier (allocated and managed by
/// ExecutionSessions) for a module added to the JIT.
using VModuleKey = uint64_t;
/// A set of symbol names (represented by SymbolStringPtrs for
// efficiency).
using SymbolNameSet = DenseSet<SymbolStringPtr>;
/// A map from symbol names (as SymbolStringPtrs) to JITSymbols
/// (address/flags pairs).
using SymbolMap = DenseMap<SymbolStringPtr, JITEvaluatedSymbol>;
/// A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
using SymbolFlagsMap = DenseMap<SymbolStringPtr, JITSymbolFlags>;
/// A base class for materialization failures that allows the failing
/// symbols to be obtained for logging.
using SymbolDependenceMap = DenseMap<JITDylib *, SymbolNameSet>;
/// A list of (JITDylib*, bool) pairs.
using JITDylibSearchList = std::vector<std::pair<JITDylib *, bool>>;
/// Render a SymbolStringPtr.
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym);
/// Render a SymbolNameSet.
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols);
/// Render a SymbolFlagsMap entry.
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap::value_type &KV);
/// Render a SymbolMap entry.
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap::value_type &KV);
/// Render a SymbolFlagsMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap &SymbolFlags);
/// Render a SymbolMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap &Symbols);
/// Render a SymbolDependenceMap entry.
raw_ostream &operator<<(raw_ostream &OS,
const SymbolDependenceMap::value_type &KV);
/// Render a SymbolDependendeMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolDependenceMap &Deps);
/// Render a MaterializationUnit.
raw_ostream &operator<<(raw_ostream &OS, const MaterializationUnit &MU);
/// Render a JITDylibSearchList.
raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs);
/// Callback to notify client that symbols have been resolved.
using SymbolsResolvedCallback = std::function<void(Expected<SymbolMap>)>;
/// Callback to notify client that symbols are ready for execution.
using SymbolsReadyCallback = std::function<void(Error)>;
/// Callback to register the dependencies for a given query.
using RegisterDependenciesFunction =
std::function<void(const SymbolDependenceMap &)>;
/// This can be used as the value for a RegisterDependenciesFunction if there
/// are no dependants to register with.
extern RegisterDependenciesFunction NoDependenciesToRegister;
/// Used to notify a JITDylib that the given set of symbols failed to
/// materialize.
class FailedToMaterialize : public ErrorInfo<FailedToMaterialize> {
public:
static char ID;
FailedToMaterialize(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
/// Used to notify clients when symbols can not be found during a lookup.
class SymbolsNotFound : public ErrorInfo<SymbolsNotFound> {
public:
static char ID;
SymbolsNotFound(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
/// Used to notify clients that a set of symbols could not be removed.
class SymbolsCouldNotBeRemoved : public ErrorInfo<SymbolsCouldNotBeRemoved> {
public:
static char ID;
SymbolsCouldNotBeRemoved(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
/// Tracks responsibility for materialization, and mediates interactions between
/// MaterializationUnits and JDs.
///

View File

@ -1,153 +0,0 @@
//===------ CoreTypes.h - ORC Core types (SymbolMap, etc.) ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Contains core ORC APIs.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_EXECUTIONENGINE_ORC_CORETYPES_H
#define LLVM_EXECUTIONENGINE_ORC_CORETYPES_H
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Error.h"
#include <system_error>
#include <vector>
#define DEBUG_TYPE "orc"
namespace llvm {
namespace orc {
class JITDylib;
class MaterializationUnit;
/// VModuleKey provides a unique identifier (allocated and managed by
/// ExecutionSessions) for a module added to the JIT.
using VModuleKey = uint64_t;
/// A set of symbol names (represented by SymbolStringPtrs for
// efficiency).
using SymbolNameSet = DenseSet<SymbolStringPtr>;
/// A map from symbol names (as SymbolStringPtrs) to JITSymbols
/// (address/flags pairs).
using SymbolMap = DenseMap<SymbolStringPtr, JITEvaluatedSymbol>;
/// A map from symbol names (as SymbolStringPtrs) to JITSymbolFlags.
using SymbolFlagsMap = DenseMap<SymbolStringPtr, JITSymbolFlags>;
/// A base class for materialization failures that allows the failing
/// symbols to be obtained for logging.
using SymbolDependenceMap = DenseMap<JITDylib *, SymbolNameSet>;
/// A list of (JITDylib*, bool) pairs.
using JITDylibSearchList = std::vector<std::pair<JITDylib *, bool>>;
/// Render a JITSymbolFlags instance.
raw_ostream &operator<<(raw_ostream &OS, const JITSymbolFlags &Flags);
/// Render a SymbolStringPtr.
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym);
/// Render a SymbolNameSet.
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols);
/// Render a SymbolFlagsMap entry.
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap::value_type &KV);
/// Render a SymbolMap entry.
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap::value_type &KV);
/// Render a SymbolFlagsMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap &SymbolFlags);
/// Render a SymbolMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap &Symbols);
/// Render a SymbolDependenceMap entry.
raw_ostream &operator<<(raw_ostream &OS,
const SymbolDependenceMap::value_type &KV);
/// Render a SymbolDependendeMap.
raw_ostream &operator<<(raw_ostream &OS, const SymbolDependenceMap &Deps);
/// Render a MaterializationUnit.
raw_ostream &operator<<(raw_ostream &OS, const MaterializationUnit &MU);
/// Render a JITDylibSearchList.
raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs);
/// Callback to notify client that symbols have been resolved.
using SymbolsResolvedCallback = std::function<void(Expected<SymbolMap>)>;
/// Callback to notify client that symbols are ready for execution.
using SymbolsReadyCallback = std::function<void(Error)>;
/// Callback to register the dependencies for a given query.
using RegisterDependenciesFunction =
std::function<void(const SymbolDependenceMap &)>;
/// This can be used as the value for a RegisterDependenciesFunction if there
/// are no dependants to register with.
extern RegisterDependenciesFunction NoDependenciesToRegister;
/// Used to notify a JITDylib that the given set of symbols failed to
/// materialize.
class FailedToMaterialize : public ErrorInfo<FailedToMaterialize> {
public:
static char ID;
FailedToMaterialize(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
/// Used to notify clients when symbols can not be found during a lookup.
class SymbolsNotFound : public ErrorInfo<SymbolsNotFound> {
public:
static char ID;
SymbolsNotFound(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
/// Used to notify clients that a set of symbols could not be removed.
class SymbolsCouldNotBeRemoved : public ErrorInfo<SymbolsCouldNotBeRemoved> {
public:
static char ID;
SymbolsCouldNotBeRemoved(SymbolNameSet Symbols);
std::error_code convertToErrorCode() const override;
void log(raw_ostream &OS) const override;
const SymbolNameSet &getSymbols() const { return Symbols; }
private:
SymbolNameSet Symbols;
};
} // End namespace orc
} // End namespace llvm
#undef DEBUG_TYPE // "orc"
#endif // LLVM_EXECUTIONENGINE_ORC_CORETYPES_H

View File

@ -1,7 +1,6 @@
add_llvm_library(LLVMOrcJIT
CompileOnDemandLayer.cpp
Core.cpp
CoreTypes.cpp
ExecutionUtils.cpp
IndirectionUtils.cpp
IRCompileLayer.cpp

View File

@ -8,6 +8,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/IR/Mangler.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
@ -19,16 +21,246 @@
#define DEBUG_TYPE "orc"
using namespace llvm;
namespace {
#ifndef NDEBUG
cl::opt<bool> PrintHidden("debug-orc-print-hidden", cl::init(false),
cl::desc("debug print hidden symbols defined by "
"materialization units"),
cl::Hidden);
cl::opt<bool> PrintCallable("debug-orc-print-callable", cl::init(false),
cl::desc("debug print callable symbols defined by "
"materialization units"),
cl::Hidden);
cl::opt<bool> PrintData("debug-orc-print-data", cl::init(false),
cl::desc("debug print data symbols defined by "
"materialization units"),
cl::Hidden);
#endif // NDEBUG
// SetPrinter predicate that prints every element.
template <typename T> struct PrintAll {
bool operator()(const T &E) { return true; }
};
bool anyPrintSymbolOptionSet() {
#ifndef NDEBUG
return PrintHidden || PrintCallable || PrintData;
#else
return false;
#endif // NDEBUG
}
bool flagsMatchCLOpts(const JITSymbolFlags &Flags) {
#ifndef NDEBUG
// Bail out early if this is a hidden symbol and we're not printing hiddens.
if (!PrintHidden && !Flags.isExported())
return false;
// Return true if this is callable and we're printing callables.
if (PrintCallable && Flags.isCallable())
return true;
// Return true if this is data and we're printing data.
if (PrintData && !Flags.isCallable())
return true;
// otherwise return false.
return false;
#else
return false;
#endif // NDEBUG
}
// Prints a set of items, filtered by an user-supplied predicate.
template <typename Set, typename Pred = PrintAll<typename Set::value_type>>
class SetPrinter {
public:
SetPrinter(const Set &S, Pred ShouldPrint = Pred())
: S(S), ShouldPrint(std::move(ShouldPrint)) {}
void printTo(llvm::raw_ostream &OS) const {
bool PrintComma = false;
OS << "{";
for (auto &E : S) {
if (ShouldPrint(E)) {
if (PrintComma)
OS << ',';
OS << ' ' << E;
PrintComma = true;
}
}
OS << " }";
}
private:
const Set &S;
mutable Pred ShouldPrint;
};
template <typename Set, typename Pred>
SetPrinter<Set, Pred> printSet(const Set &S, Pred P = Pred()) {
return SetPrinter<Set, Pred>(S, std::move(P));
}
// Render a SetPrinter by delegating to its printTo method.
template <typename Set, typename Pred>
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const SetPrinter<Set, Pred> &Printer) {
Printer.printTo(OS);
return OS;
}
struct PrintSymbolFlagsMapElemsMatchingCLOpts {
bool operator()(const orc::SymbolFlagsMap::value_type &KV) {
return flagsMatchCLOpts(KV.second);
}
};
struct PrintSymbolMapElemsMatchingCLOpts {
bool operator()(const orc::SymbolMap::value_type &KV) {
return flagsMatchCLOpts(KV.second.getFlags());
}
};
} // end anonymous namespace
namespace llvm {
namespace orc {
SymbolStringPool::PoolMapEntry SymbolStringPtr::Tombstone(0);
SymbolStringPool::PoolMapEntry SymbolStringPtr::Tombstone(0);
char FailedToMaterialize::ID = 0;
char SymbolsNotFound::ID = 0;
char SymbolsCouldNotBeRemoved::ID = 0;
RegisterDependenciesFunction NoDependenciesToRegister =
RegisterDependenciesFunction();
void MaterializationUnit::anchor() {}
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym) {
return OS << *Sym;
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols) {
return OS << printSet(Symbols, PrintAll<SymbolStringPtr>());
}
raw_ostream &operator<<(raw_ostream &OS, const JITSymbolFlags &Flags) {
if (Flags.isCallable())
OS << "[Callable]";
else
OS << "[Data]";
if (Flags.isWeak())
OS << "[Weak]";
else if (Flags.isCommon())
OS << "[Common]";
if (!Flags.isExported())
OS << "[Hidden]";
return OS;
}
raw_ostream &operator<<(raw_ostream &OS, const JITEvaluatedSymbol &Sym) {
return OS << format("0x%016" PRIx64, Sym.getAddress()) << " "
<< Sym.getFlags();
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap::value_type &KV) {
return OS << "(\"" << KV.first << "\", " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap::value_type &KV) {
return OS << "(\"" << KV.first << "\": " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap &SymbolFlags) {
return OS << printSet(SymbolFlags, PrintSymbolFlagsMapElemsMatchingCLOpts());
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap &Symbols) {
return OS << printSet(Symbols, PrintSymbolMapElemsMatchingCLOpts());
}
raw_ostream &operator<<(raw_ostream &OS,
const SymbolDependenceMap::value_type &KV) {
return OS << "(" << KV.first << ", " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolDependenceMap &Deps) {
return OS << printSet(Deps, PrintAll<SymbolDependenceMap::value_type>());
}
raw_ostream &operator<<(raw_ostream &OS, const MaterializationUnit &MU) {
OS << "MU@" << &MU << " (\"" << MU.getName() << "\"";
if (anyPrintSymbolOptionSet())
OS << ", " << MU.getSymbols();
return OS << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs) {
OS << "[";
if (!JDs.empty()) {
assert(JDs.front().first && "JITDylibList entries must not be null");
OS << " (\"" << JDs.front().first->getName() << "\", "
<< (JDs.front().second ? "true" : "false") << ")";
for (auto &KV : make_range(std::next(JDs.begin()), JDs.end())) {
assert(KV.first && "JITDylibList entries must not be null");
OS << ", (\"" << KV.first->getName() << "\", "
<< (KV.second ? "true" : "false") << ")";
}
}
OS << " ]";
return OS;
}
FailedToMaterialize::FailedToMaterialize(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code FailedToMaterialize::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void FailedToMaterialize::log(raw_ostream &OS) const {
OS << "Failed to materialize symbols: " << Symbols;
}
SymbolsNotFound::SymbolsNotFound(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code SymbolsNotFound::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void SymbolsNotFound::log(raw_ostream &OS) const {
OS << "Symbols not found: " << Symbols;
}
SymbolsCouldNotBeRemoved::SymbolsCouldNotBeRemoved(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code SymbolsCouldNotBeRemoved::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void SymbolsCouldNotBeRemoved::log(raw_ostream &OS) const {
OS << "Symbols could not be removed: " << Symbols;
}
AsynchronousSymbolQuery::AsynchronousSymbolQuery(
const SymbolNameSet &Symbols, SymbolsResolvedCallback NotifySymbolsResolved,
SymbolsReadyCallback NotifySymbolsReady)

View File

@ -1,254 +0,0 @@
//===--- Core.cpp - Core ORC APIs (MaterializationUnit, JITDylib, etc.) ---===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "llvm/ExecutionEngine/Orc/CoreTypes.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/OrcError.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Format.h"
#define DEBUG_TYPE "orc"
using namespace llvm;
namespace {
#ifndef NDEBUG
cl::opt<bool> PrintHidden("debug-orc-print-hidden", cl::init(false),
cl::desc("debug print hidden symbols defined by "
"materialization units"),
cl::Hidden);
cl::opt<bool> PrintCallable("debug-orc-print-callable", cl::init(false),
cl::desc("debug print callable symbols defined by "
"materialization units"),
cl::Hidden);
cl::opt<bool> PrintData("debug-orc-print-data", cl::init(false),
cl::desc("debug print data symbols defined by "
"materialization units"),
cl::Hidden);
#endif // NDEBUG
// SetPrinter predicate that prints every element.
template <typename T> struct PrintAll {
bool operator()(const T &E) { return true; }
};
bool anyPrintSymbolOptionSet() {
#ifndef NDEBUG
return PrintHidden || PrintCallable || PrintData;
#else
return false;
#endif // NDEBUG
}
bool flagsMatchCLOpts(const JITSymbolFlags &Flags) {
#ifndef NDEBUG
// Bail out early if this is a hidden symbol and we're not printing hiddens.
if (!PrintHidden && !Flags.isExported())
return false;
// Return true if this is callable and we're printing callables.
if (PrintCallable && Flags.isCallable())
return true;
// Return true if this is data and we're printing data.
if (PrintData && !Flags.isCallable())
return true;
// otherwise return false.
return false;
#else
return false;
#endif // NDEBUG
}
// Prints a set of items, filtered by an user-supplied predicate.
template <typename Set, typename Pred = PrintAll<typename Set::value_type>>
class SetPrinter {
public:
SetPrinter(const Set &S, Pred ShouldPrint = Pred())
: S(S), ShouldPrint(std::move(ShouldPrint)) {}
void printTo(llvm::raw_ostream &OS) const {
bool PrintComma = false;
OS << "{";
for (auto &E : S) {
if (ShouldPrint(E)) {
if (PrintComma)
OS << ',';
OS << ' ' << E;
PrintComma = true;
}
}
OS << " }";
}
private:
const Set &S;
mutable Pred ShouldPrint;
};
template <typename Set, typename Pred>
SetPrinter<Set, Pred> printSet(const Set &S, Pred P = Pred()) {
return SetPrinter<Set, Pred>(S, std::move(P));
}
// Render a SetPrinter by delegating to its printTo method.
template <typename Set, typename Pred>
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const SetPrinter<Set, Pred> &Printer) {
Printer.printTo(OS);
return OS;
}
struct PrintSymbolFlagsMapElemsMatchingCLOpts {
bool operator()(const orc::SymbolFlagsMap::value_type &KV) {
return flagsMatchCLOpts(KV.second);
}
};
struct PrintSymbolMapElemsMatchingCLOpts {
bool operator()(const orc::SymbolMap::value_type &KV) {
return flagsMatchCLOpts(KV.second.getFlags());
}
};
} // end anonymous namespace
namespace llvm {
namespace orc {
char FailedToMaterialize::ID = 0;
char SymbolsNotFound::ID = 0;
char SymbolsCouldNotBeRemoved::ID = 0;
raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtr &Sym) {
return OS << *Sym;
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolNameSet &Symbols) {
return OS << printSet(Symbols, PrintAll<SymbolStringPtr>());
}
raw_ostream &operator<<(raw_ostream &OS, const JITSymbolFlags &Flags) {
if (Flags.isCallable())
OS << "[Callable]";
else
OS << "[Data]";
if (Flags.isWeak())
OS << "[Weak]";
else if (Flags.isCommon())
OS << "[Common]";
if (!Flags.isExported())
OS << "[Hidden]";
return OS;
}
raw_ostream &operator<<(raw_ostream &OS, const JITEvaluatedSymbol &Sym) {
return OS << format("0x%016" PRIx64, Sym.getAddress()) << " "
<< Sym.getFlags();
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap::value_type &KV) {
return OS << "(\"" << KV.first << "\", " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap::value_type &KV) {
return OS << "(\"" << KV.first << "\": " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolFlagsMap &SymbolFlags) {
return OS << printSet(SymbolFlags, PrintSymbolFlagsMapElemsMatchingCLOpts());
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolMap &Symbols) {
return OS << printSet(Symbols, PrintSymbolMapElemsMatchingCLOpts());
}
raw_ostream &operator<<(raw_ostream &OS,
const SymbolDependenceMap::value_type &KV) {
return OS << "(" << KV.first << ", " << KV.second << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const SymbolDependenceMap &Deps) {
return OS << printSet(Deps, PrintAll<SymbolDependenceMap::value_type>());
}
raw_ostream &operator<<(raw_ostream &OS, const MaterializationUnit &MU) {
OS << "MU@" << &MU << " (\"" << MU.getName() << "\"";
if (anyPrintSymbolOptionSet())
OS << ", " << MU.getSymbols();
return OS << ")";
}
raw_ostream &operator<<(raw_ostream &OS, const JITDylibSearchList &JDs) {
OS << "[";
if (!JDs.empty()) {
assert(JDs.front().first && "JITDylibList entries must not be null");
OS << " (\"" << JDs.front().first->getName() << "\", "
<< (JDs.front().second ? "true" : "false") << ")";
for (auto &KV : make_range(std::next(JDs.begin()), JDs.end())) {
assert(KV.first && "JITDylibList entries must not be null");
OS << ", (\"" << KV.first->getName() << "\", "
<< (KV.second ? "true" : "false") << ")";
}
}
OS << " ]";
return OS;
}
FailedToMaterialize::FailedToMaterialize(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code FailedToMaterialize::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void FailedToMaterialize::log(raw_ostream &OS) const {
OS << "Failed to materialize symbols: " << Symbols;
}
SymbolsNotFound::SymbolsNotFound(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code SymbolsNotFound::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void SymbolsNotFound::log(raw_ostream &OS) const {
OS << "Symbols not found: " << Symbols;
}
SymbolsCouldNotBeRemoved::SymbolsCouldNotBeRemoved(SymbolNameSet Symbols)
: Symbols(std::move(Symbols)) {
assert(!this->Symbols.empty() && "Can not fail to resolve an empty set");
}
std::error_code SymbolsCouldNotBeRemoved::convertToErrorCode() const {
return orcError(OrcErrorCode::UnknownORCError);
}
void SymbolsCouldNotBeRemoved::log(raw_ostream &OS) const {
OS << "Symbols could not be removed: " << Symbols;
}
} // End namespace orc.
} // End namespace llvm.