diff options
Diffstat (limited to 'mlir/lib/IR/StmtBlock.cpp')
| -rw-r--r-- | mlir/lib/IR/StmtBlock.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/mlir/lib/IR/StmtBlock.cpp b/mlir/lib/IR/StmtBlock.cpp index 40a31f6c3b9..898dd7bc337 100644 --- a/mlir/lib/IR/StmtBlock.cpp +++ b/mlir/lib/IR/StmtBlock.cpp @@ -24,18 +24,19 @@ using namespace mlir; // Statement block //===----------------------------------------------------------------------===// -Statement *StmtBlock::getContainingStmt() const { +Statement *StmtBlock::getContainingStmt() { switch (kind) { case StmtBlockKind::MLFunc: return nullptr; - case StmtBlockKind::For: - return cast<ForStmt>(const_cast<StmtBlock *>(this)); + case StmtBlockKind::ForBody: + return cast<ForStmtBody>(this)->getFor(); case StmtBlockKind::IfClause: return cast<IfClause>(this)->getIf(); } } MLFunction *StmtBlock::findFunction() const { + // FIXME: const incorrect. StmtBlock *block = const_cast<StmtBlock *>(this); while (block->getContainingStmt()) { |

