aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/DebugInfo/DIContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/DebugInfo/DIContext.h')
-rw-r--r--include/llvm/DebugInfo/DIContext.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/llvm/DebugInfo/DIContext.h b/include/llvm/DebugInfo/DIContext.h
index 4126e245ff13..936813dc6abc 100644
--- a/include/llvm/DebugInfo/DIContext.h
+++ b/include/llvm/DebugInfo/DIContext.h
@@ -204,7 +204,9 @@ public:
/// need to be consistent with the addresses used to query the DIContext and
/// the output of this function should be deterministic, i.e. repeated calls with
/// the same Sec should give the same address.
- virtual uint64_t getSectionLoadAddress(const object::SectionRef &Sec) const = 0;
+ virtual uint64_t getSectionLoadAddress(const object::SectionRef &Sec) const {
+ return 0;
+ }
/// If conveniently available, return the content of the given Section.
///
@@ -221,12 +223,28 @@ public:
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.
- ///
- /// The caller is responsible for deallocation once the copy is no longer required.
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
#endif // LLVM_DEBUGINFO_DICONTEXT_H