[BOLT][NFC] Const-ify getDynamicRelocationAt
authorAmir Ayupov <aaupov@fb.com>
Mon, 12 Jun 2023 16:54:42 +0000 (09:54 -0700)
committerAmir Ayupov <aaupov@fb.com>
Mon, 12 Jun 2023 16:55:16 +0000 (09:55 -0700)
Reviewed By: #bolt, maksfb

Differential Revision: https://reviews.llvm.org/D152662

bolt/include/bolt/Core/BinaryContext.h
bolt/lib/Core/BinaryContext.cpp

index 7e2d4d6..8fa0549 100644 (file)
@@ -1165,7 +1165,7 @@ public:
 
   /// Return a dynamic relocation registered at a given \p Address, or nullptr
   /// if there is no dynamic relocation at such address.
-  const Relocation *getDynamicRelocationAt(uint64_t Address);
+  const Relocation *getDynamicRelocationAt(uint64_t Address) const;
 
   /// Remove registered relocation at a given \p Address.
   bool removeRelocationAt(uint64_t Address);
index d81b669..8af8a2a 100644 (file)
@@ -2100,8 +2100,9 @@ const Relocation *BinaryContext::getRelocationAt(uint64_t Address) const {
   return Section->getRelocationAt(Address - Section->getAddress());
 }
 
-const Relocation *BinaryContext::getDynamicRelocationAt(uint64_t Address) {
-  ErrorOr<BinarySection &> Section = getSectionForAddress(Address);
+const Relocation *
+BinaryContext::getDynamicRelocationAt(uint64_t Address) const {
+  ErrorOr<const BinarySection &> Section = getSectionForAddress(Address);
   if (!Section)
     return nullptr;