mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
DebugInfo: Generalize LoadedObjectInfoHelper from RuntimeDyld
Make it usable by any class derived (even indirectly) from LoadedObjectInfo by allowing a custom base class to be specified and perfect forwarding to the ctor. llvm-svn: 307166
This commit is contained in:
parent
06935b98f4
commit
061c32748f
@ -221,12 +221,28 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This is untested and unused anywhere in the LLVM project, it's
|
||||||
|
// used/needed by Julia (an external project). It should have some coverage
|
||||||
|
// (at least tests, but ideally example functionality).
|
||||||
/// Obtain a copy of this LoadedObjectInfo.
|
/// Obtain a copy of this LoadedObjectInfo.
|
||||||
///
|
|
||||||
/// The caller is responsible for deallocation once the copy is no longer required.
|
|
||||||
virtual std::unique_ptr<LoadedObjectInfo> clone() const = 0;
|
virtual std::unique_ptr<LoadedObjectInfo> clone() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename Derived, typename Base = LoadedObjectInfo>
|
||||||
|
struct LoadedObjectInfoHelper : Base {
|
||||||
|
protected:
|
||||||
|
LoadedObjectInfoHelper(const LoadedObjectInfoHelper &) = default;
|
||||||
|
LoadedObjectInfoHelper() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
|
template <typename... Ts>
|
||||||
|
LoadedObjectInfoHelper(Ts &&... Args) : Base(std::forward<Ts>(Args)...) {}
|
||||||
|
|
||||||
|
std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
|
||||||
|
return llvm::make_unique<Derived>(static_cast<const Derived &>(*this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif // LLVM_DEBUGINFO_DICONTEXT_H
|
#endif // LLVM_DEBUGINFO_DICONTEXT_H
|
||||||
|
@ -88,21 +88,6 @@ public:
|
|||||||
ObjSectionToIDMap ObjSecToIDMap;
|
ObjSectionToIDMap ObjSecToIDMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename Derived> struct LoadedObjectInfoHelper : LoadedObjectInfo {
|
|
||||||
protected:
|
|
||||||
LoadedObjectInfoHelper(const LoadedObjectInfoHelper &) = default;
|
|
||||||
LoadedObjectInfoHelper() = default;
|
|
||||||
|
|
||||||
public:
|
|
||||||
LoadedObjectInfoHelper(RuntimeDyldImpl &RTDyld,
|
|
||||||
LoadedObjectInfo::ObjSectionToIDMap ObjSecToIDMap)
|
|
||||||
: LoadedObjectInfo(RTDyld, std::move(ObjSecToIDMap)) {}
|
|
||||||
|
|
||||||
std::unique_ptr<llvm::LoadedObjectInfo> clone() const override {
|
|
||||||
return llvm::make_unique<Derived>(static_cast<const Derived &>(*this));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// \brief Memory Management.
|
/// \brief Memory Management.
|
||||||
class MemoryManager {
|
class MemoryManager {
|
||||||
friend class RuntimeDyld;
|
friend class RuntimeDyld;
|
||||||
|
@ -27,9 +27,12 @@ using namespace llvm::object;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class LoadedCOFFObjectInfo final
|
class LoadedCOFFObjectInfo final
|
||||||
: public RuntimeDyld::LoadedObjectInfoHelper<LoadedCOFFObjectInfo> {
|
: public LoadedObjectInfoHelper<LoadedCOFFObjectInfo,
|
||||||
|
RuntimeDyld::LoadedObjectInfo> {
|
||||||
public:
|
public:
|
||||||
LoadedCOFFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
|
LoadedCOFFObjectInfo(
|
||||||
|
RuntimeDyldImpl &RTDyld,
|
||||||
|
RuntimeDyld::LoadedObjectInfo::ObjSectionToIDMap ObjSecToIDMap)
|
||||||
: LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
|
: LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
|
||||||
|
|
||||||
OwningBinary<ObjectFile>
|
OwningBinary<ObjectFile>
|
||||||
|
@ -123,7 +123,8 @@ void DyldELFObject<ELFT>::updateSymbolAddress(const SymbolRef &SymRef,
|
|||||||
}
|
}
|
||||||
|
|
||||||
class LoadedELFObjectInfo final
|
class LoadedELFObjectInfo final
|
||||||
: public RuntimeDyld::LoadedObjectInfoHelper<LoadedELFObjectInfo> {
|
: public LoadedObjectInfoHelper<LoadedELFObjectInfo,
|
||||||
|
RuntimeDyld::LoadedObjectInfo> {
|
||||||
public:
|
public:
|
||||||
LoadedELFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
|
LoadedELFObjectInfo(RuntimeDyldImpl &RTDyld, ObjSectionToIDMap ObjSecToIDMap)
|
||||||
: LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
|
: LoadedObjectInfoHelper(RTDyld, std::move(ObjSecToIDMap)) {}
|
||||||
|
@ -27,7 +27,8 @@ using namespace llvm::object;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class LoadedMachOObjectInfo final
|
class LoadedMachOObjectInfo final
|
||||||
: public RuntimeDyld::LoadedObjectInfoHelper<LoadedMachOObjectInfo> {
|
: public LoadedObjectInfoHelper<LoadedMachOObjectInfo,
|
||||||
|
RuntimeDyld::LoadedObjectInfo> {
|
||||||
public:
|
public:
|
||||||
LoadedMachOObjectInfo(RuntimeDyldImpl &RTDyld,
|
LoadedMachOObjectInfo(RuntimeDyldImpl &RTDyld,
|
||||||
ObjSectionToIDMap ObjSecToIDMap)
|
ObjSectionToIDMap ObjSecToIDMap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user