/// or nullptr it the function does not have a module.
///
/// Note: this is undefined behavior if the block does not have a parent.
- const Module *getModule() const;
Module *getModule();
+ const Module *getModule() const {
+ return const_cast<BasicBlock *>(this)->getModule();
+ }
/// \brief Returns the terminator instruction if the block is well formed or
/// null if the block is not well formed.
TerminatorInst *getTerminator();
- const TerminatorInst *getTerminator() const;
+ const TerminatorInst *getTerminator() const {
+ return const_cast<BasicBlock *>(this)->getTerminator();
+ }
/// \brief Returns the call instruction calling @llvm.experimental.deoptimize
/// prior to the terminating return instruction of this basic block, if such a
getIterator());
}
-const Module *BasicBlock::getModule() const {
- return getParent()->getParent();
-}
-
Module *BasicBlock::getModule() {
return getParent()->getParent();
}
return dyn_cast<TerminatorInst>(&InstList.back());
}
-const TerminatorInst *BasicBlock::getTerminator() const {
- if (InstList.empty()) return nullptr;
- return dyn_cast<TerminatorInst>(&InstList.back());
-}
-
CallInst *BasicBlock::getTerminatingMustTailCall() {
if (InstList.empty())
return nullptr;