Skip to content

[mlir][IR] Mark getParentBlock() and getParentRegion() as const (NFC) #151915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mlir/include/mlir/IR/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class Value {
void setLoc(Location loc);

/// Return the Region in which this Value is defined.
Region *getParentRegion();
Region *getParentRegion() const;

/// Return the Block in which this Value is defined.
Block *getParentBlock();
Block *getParentBlock() const;

//===--------------------------------------------------------------------===//
// UseLists
Expand Down
4 changes: 2 additions & 2 deletions mlir/lib/IR/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ void Value::setLoc(Location loc) {
}

/// Return the Region in which this Value is defined.
Region *Value::getParentRegion() {
Region *Value::getParentRegion() const {
if (auto *op = getDefiningOp())
return op->getParentRegion();
return llvm::cast<BlockArgument>(*this).getOwner()->getParent();
}

/// Return the Block in which this Value is defined.
Block *Value::getParentBlock() {
Block *Value::getParentBlock() const {
if (Operation *op = getDefiningOp())
return op->getBlock();
return llvm::cast<BlockArgument>(*this).getOwner();
Expand Down