[PATCH] D140162: [NFC] Cleanup: Function::getBasicBlockList() and Function::getSublistAccess() are now private

Vasileios Porpodas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 15 13:21:14 PST 2022


vporpo created this revision.
vporpo added reviewers: aeubanks, asbirlea.
Herald added a project: All.
vporpo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The Function class now supports an adequate set of member functions to help
modify the BB list, including Function::splice(), Function::erase(),
Function::insert() etc. so we no longer need access to the underlying list.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140162

Files:
  llvm/include/llvm/IR/Function.h


Index: llvm/include/llvm/IR/Function.h
===================================================================
--- llvm/include/llvm/IR/Function.h
+++ llvm/include/llvm/IR/Function.h
@@ -719,6 +719,15 @@
   /// \Returns \p ToIt.
   Function::iterator erase(Function::iterator FromIt, Function::iterator ToIt);
 
+private:
+  // These need access to the underlying BB list.
+  friend void BasicBlock::removeFromParent();
+  friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
+  template <class BB_t, class BB_i_t, class BI_t, class II_t>
+  friend class InstIterator;
+  friend class llvm::SymbolTableListTraits<llvm::BasicBlock>;
+  friend class llvm::ilist_node_with_parent<llvm::BasicBlock, llvm::Function>;
+
   /// Get the underlying elements of the Function... the basic block list is
   /// empty for external functions.
   ///
@@ -732,6 +741,7 @@
     return &Function::BasicBlocks;
   }
 
+public:
   const BasicBlock       &getEntryBlock() const   { return front(); }
         BasicBlock       &getEntryBlock()         { return front(); }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140162.483316.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221215/2110cb40/attachment.bin>


More information about the llvm-commits mailing list