[PATCH] D152869: [nfc] Factoring out utility that can be used for other object-level tools

Dayann D'almeida via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 22 10:28:02 PDT 2023


JestrTulip updated this revision to Diff 533691.
JestrTulip added a comment.

feedback: west const for non-const functions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152869/new/

https://reviews.llvm.org/D152869

Files:
  llvm/include/llvm/Object/ObjectFile.h


Index: llvm/include/llvm/Object/ObjectFile.h
===================================================================
--- llvm/include/llvm/Object/ObjectFile.h
+++ llvm/include/llvm/Object/ObjectFile.h
@@ -46,7 +46,7 @@
 
 using section_iterator = content_iterator<SectionRef>;
 
-typedef std::function<bool(llvm::object::SectionRef const &)> SectionFilterPredicate;
+typedef std::function<bool(const SectionRef &)> SectionFilterPredicate;
 /// This is a value type class that represents a single relocation in the list
 /// of relocations in the object file.
 class RelocationRef {
@@ -405,12 +405,12 @@
 class SectionFilterIterator {
 public:
   SectionFilterIterator(SectionFilterPredicate Pred,
-                        llvm::object::section_iterator const &Begin,
-                        llvm::object::section_iterator const &End)
+                        const section_iterator &Begin,
+                        const section_iterator &End)
       : Predicate(std::move(Pred)), Iterator(Begin), End(End) {
     scanPredicate();
   }
-  const llvm::object::SectionRef &operator*() const { return *Iterator; }
+  const SectionRef &operator*() const { return *Iterator; }
   SectionFilterIterator &operator++() {
     ++Iterator;
     scanPredicate();
@@ -427,15 +427,15 @@
     }
   }
   SectionFilterPredicate Predicate;
-  llvm::object::section_iterator Iterator;
-  llvm::object::section_iterator End;
+  section_iterator Iterator;
+  section_iterator End;
 };
 
 /// Creates an iterator range of SectionFilterIterators for a given Object and
 /// predicate.
 class SectionFilter {
 public:
-  SectionFilter(SectionFilterPredicate Pred, llvm::object::ObjectFile const &Obj)
+  SectionFilter(SectionFilterPredicate Pred, const ObjectFile &Obj)
       : Predicate(std::move(Pred)), Object(Obj) {}
   SectionFilterIterator begin() {
     return SectionFilterIterator(Predicate, Object.section_begin(),
@@ -448,7 +448,7 @@
 
 private:
   SectionFilterPredicate Predicate;
-  llvm::object::ObjectFile const &Object;
+  const ObjectFile &Object;
 };
 
 // Inline function definitions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152869.533691.patch
Type: text/x-patch
Size: 2081 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230622/7574a574/attachment.bin>


More information about the llvm-commits mailing list