[ORC][JITLink] Move JITDylib name into JITLinkDylib base class.

This will enable better error messages and debug logs in JITLink.
This commit is contained in:
Lang Hames 2021-11-19 20:51:44 -08:00
parent 97b9e8438e
commit 43f5f6916f
3 changed files with 14 additions and 7 deletions

View File

@ -13,10 +13,21 @@
#ifndef LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H
#define LLVM_EXECUTIONENGINE_JITLINK_JITLINKDYLIB_H
#include <string>
namespace llvm {
namespace jitlink {
class JITLinkDylib {};
class JITLinkDylib {
public:
JITLinkDylib(std::string Name) : Name(std::move(Name)) {}
/// Get the name for this JITLinkDylib.
const std::string &getName() const { return Name; }
private:
std::string Name;
};
} // end namespace jitlink
} // end namespace llvm

View File

@ -935,9 +935,6 @@ public:
JITDylib(JITDylib &&) = delete;
JITDylib &operator=(JITDylib &&) = delete;
/// Get the name for this JITDylib.
const std::string &getName() const { return JITDylibName; }
/// Get a reference to the ExecutionSession for this JITDylib.
ExecutionSession &getExecutionSession() const { return ES; }
@ -1200,7 +1197,6 @@ private:
failSymbols(FailedSymbolsWorklist);
ExecutionSession &ES;
std::string JITDylibName;
std::mutex GeneratorsMutex;
bool Open = true;
SymbolTable Symbols;

View File

@ -1364,7 +1364,7 @@ Error JITDylib::remove(const SymbolNameSet &Names) {
void JITDylib::dump(raw_ostream &OS) {
ES.runSessionLocked([&, this]() {
OS << "JITDylib \"" << JITDylibName << "\" (ES: "
OS << "JITDylib \"" << getName() << "\" (ES: "
<< format("0x%016" PRIx64, reinterpret_cast<uintptr_t>(&ES)) << "):\n"
<< "Link order: " << LinkOrder << "\n"
<< "Symbol table:\n";
@ -1450,7 +1450,7 @@ JITDylib::MaterializingInfo::takeQueriesMeeting(SymbolState RequiredState) {
}
JITDylib::JITDylib(ExecutionSession &ES, std::string Name)
: ES(ES), JITDylibName(std::move(Name)) {
: JITLinkDylib(std::move(Name)), ES(ES) {
LinkOrder.push_back({this, JITDylibLookupFlags::MatchAllSymbols});
}