1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Add Instruction::getFunction; NFC

Will be used in a upcoming patch.

llvm-svn: 254975
This commit is contained in:
Sanjoy Das 2015-12-08 00:13:12 +00:00
parent b28303ef74
commit 9d4e519ec7
2 changed files with 12 additions and 0 deletions

View File

@ -66,6 +66,13 @@ public:
const Module *getModule() const; const Module *getModule() const;
Module *getModule(); Module *getModule();
/// \brief Return the function this instruction belongs to.
///
/// Note: it is undefined behavior to call this on an instruction not
/// currently inserted into a function.
const Function *getFunction() const;
Function *getFunction();
/// removeFromParent - This method unlinks 'this' from the containing basic /// removeFromParent - This method unlinks 'this' from the containing basic
/// block, but does not delete it. /// block, but does not delete it.
/// ///

View File

@ -62,6 +62,11 @@ Module *Instruction::getModule() {
return getParent()->getModule(); return getParent()->getModule();
} }
Function *Instruction::getFunction() { return getParent()->getParent(); }
const Function *Instruction::getFunction() const {
return getParent()->getParent();
}
void Instruction::removeFromParent() { void Instruction::removeFromParent() {
getParent()->getInstList().remove(getIterator()); getParent()->getInstList().remove(getIterator());