[PATCH] D35009: [DWARF] - Provide default implementations for methods of LoadedObjectInfo

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 04:51:33 PDT 2017


grimar created this revision.

It is a bit unconvinent that client should implement stubs for these two methods
on its side even if not use them at all.

For example in https://reviews.llvm.org/D35005 I do not need them both, also there is one more
place in LLD where LoadedObjectInfo is used and have to implement stub clone()
method.

I suggest to provide default implementations.


https://reviews.llvm.org/D35009

Files:
  include/llvm/DebugInfo/DIContext.h


Index: include/llvm/DebugInfo/DIContext.h
===================================================================
--- include/llvm/DebugInfo/DIContext.h
+++ include/llvm/DebugInfo/DIContext.h
@@ -204,7 +204,9 @@
   /// 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.
   ///
@@ -224,7 +226,7 @@
   /// 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 { return {}; }
 };
 
 } // end namespace llvm


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35009.105255.patch
Type: text/x-patch
Size: 1022 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170705/194956ac/attachment-0001.bin>


More information about the llvm-commits mailing list