Remove getDataLayout() from Instruction/GlobalValue/BasicBlock/Function

Summary:
This does not conceptually belongs here. Instead provide a shortcut
getModule() that provides access to the DataLayout.

Reviewers: chandlerc, echristo

Reviewed By: echristo

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D8027

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231147 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Mehdi Amini
2015-03-03 22:01:13 +00:00
parent 7cecca6011
commit a716c07147
8 changed files with 23 additions and 20 deletions

View File

@@ -32,10 +32,6 @@ Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
}
}
const DataLayout *Instruction::getDataLayout() const {
return getParent()->getDataLayout();
}
Instruction::Instruction(Type *ty, unsigned it, Use *Ops, unsigned NumOps,
BasicBlock *InsertAtEnd)
: User(ty, Value::InstructionVal + it, Ops, NumOps), Parent(nullptr) {
@@ -58,6 +54,10 @@ void Instruction::setParent(BasicBlock *P) {
Parent = P;
}
const Module *Instruction::getModule() const {
return getParent()->getModule();
}
void Instruction::removeFromParent() {
getParent()->getInstList().remove(this);
}