[llvm] ad36f76 - [NFC] Cleanup: Function::getBasicBlockList() and Function::getSublistAccess() are now private
Vasileios Porpodas via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 15 21:42:02 PST 2022
Author: Vasileios Porpodas
Date: 2022-12-15T21:41:24-08:00
New Revision: ad36f767a4d183318b2e3a33dfc1b86a50ac2ab1
URL: https://github.com/llvm/llvm-project/commit/ad36f767a4d183318b2e3a33dfc1b86a50ac2ab1
DIFF: https://github.com/llvm/llvm-project/commit/ad36f767a4d183318b2e3a33dfc1b86a50ac2ab1.diff
LOG: [NFC] Cleanup: Function::getBasicBlockList() and Function::getSublistAccess() are now private
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.
Differential Revision: https://reviews.llvm.org/D140162
Added:
Modified:
llvm/include/llvm/IR/Function.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h
index 8d0f318cf56ab..75650e2955c2d 100644
--- a/llvm/include/llvm/IR/Function.h
+++ b/llvm/include/llvm/IR/Function.h
@@ -719,6 +719,15 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
/// \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 @@ class LLVM_EXTERNAL_VISIBILITY Function : public GlobalObject,
return &Function::BasicBlocks;
}
+public:
const BasicBlock &getEntryBlock() const { return front(); }
BasicBlock &getEntryBlock() { return front(); }
More information about the llvm-commits
mailing list