aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-10-11 22:21:39 +0000
committerChris Lattner <sabre@nondot.org>2004-10-11 22:21:39 +0000
commit4b83380f330b1c77bb9b4ad8f63bdcf1a596afd6 (patch)
tree7fb6b7a7996f2faeda2f96657ce06ac830492135 /lib
parentb92f50fe6091a7a12f54f9884529b1127b1a14e5 (diff)
downloadexternal_llvm-4b83380f330b1c77bb9b4ad8f63bdcf1a596afd6.zip
external_llvm-4b83380f330b1c77bb9b4ad8f63bdcf1a596afd6.tar.gz
external_llvm-4b83380f330b1c77bb9b4ad8f63bdcf1a596afd6.tar.bz2
Implement remove/eraseFromParent methods
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/BasicBlock.cpp9
-rw-r--r--lib/VMCore/Function.cpp8
-rw-r--r--lib/VMCore/Globals.cpp11
-rw-r--r--lib/VMCore/Instruction.cpp7
4 files changed, 33 insertions, 2 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index 32c86c4..2e8560c 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -105,6 +105,15 @@ void BasicBlock::setName(const std::string &name, SymbolTable *ST) {
if (P && hasName()) P->getSymbolTable().insert(this);
}
+void BasicBlock::removeFromParent() {
+ getParent()->getBasicBlockList().remove(this);
+}
+
+void BasicBlock::eraseFromParent() {
+ getParent()->getBasicBlockList().erase(this);
+}
+
+
TerminatorInst *BasicBlock::getTerminator() {
if (InstList.empty()) return 0;
return dyn_cast<TerminatorInst>(&InstList.back());
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index e918fd5..ede2ca2 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -147,6 +147,14 @@ const Type *Function::getReturnType() const {
return getFunctionType()->getReturnType();
}
+void Function::removeFromParent() {
+ getParent()->getFunctionList().remove(this);
+}
+
+void Function::eraseFromParent() {
+ getParent()->getFunctionList().erase(this);
+}
+
// dropAllReferences() - This function causes all the subinstructions to "let
// go" of all references that they are maintaining. This allows one to
// 'delete' a whole class at a time, even though there may be circular
diff --git a/lib/VMCore/Globals.cpp b/lib/VMCore/Globals.cpp
index b84dbf7..731f495 100644
--- a/lib/VMCore/Globals.cpp
+++ b/lib/VMCore/Globals.cpp
@@ -106,9 +106,16 @@ void GlobalVariable::setName(const std::string &name, SymbolTable *ST) {
if (P && hasName()) P->getSymbolTable().insert(this);
}
+void GlobalVariable::removeFromParent() {
+ getParent()->getGlobalList().remove(this);
+}
+
+void GlobalVariable::eraseFromParent() {
+ getParent()->getGlobalList().erase(this);
+}
+
void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To,
- bool DisableChecking )
-{
+ bool DisableChecking) {
// If you call this, then you better know this GVar has a constant
// initializer worth replacing. Enforce that here.
assert(getNumOperands() == 1 &&
diff --git a/lib/VMCore/Instruction.cpp b/lib/VMCore/Instruction.cpp
index f54acf5..4ea5775 100644
--- a/lib/VMCore/Instruction.cpp
+++ b/lib/VMCore/Instruction.cpp
@@ -72,6 +72,13 @@ void Instruction::setName(const std::string &name, SymbolTable *ST) {
if (PP && hasName()) PP->getSymbolTable().insert(this);
}
+void Instruction::removeFromParent() {
+ getParent()->getInstList().remove(this);
+}
+
+void Instruction::eraseFromParent() {
+ getParent()->getInstList().erase(this);
+}
const char *Instruction::getOpcodeName(unsigned OpCode) {
switch (OpCode) {