Add MLFunction::getReturnStmt.

PiperOrigin-RevId: 208514441
This commit is contained in:
Uday Bondhugula
2018-08-13 11:30:36 -07:00
committed by jpienaar
parent 067d70f20d
commit 95c1bf445a
2 changed files with 12 additions and 0 deletions

View File

@@ -80,6 +80,10 @@ public:
~MLFunction();
// Return the 'return' statement of this MLFunction.
const OperationStmt *getReturnStmt() const;
OperationStmt *getReturnStmt();
/// Methods for support type inquiry through isa, cast, and dyn_cast.
static bool classof(const Function *func) {
return func->getKind() == Function::Kind::MLFunc;

View File

@@ -152,3 +152,11 @@ void MLFunction::destroy() {
this->~MLFunction();
free(this);
}
const OperationStmt *MLFunction::getReturnStmt() const {
return cast<OperationStmt>(&back());
}
OperationStmt *MLFunction::getReturnStmt() {
return cast<OperationStmt>(&back());
}