`Region`s and `Block`s locations


While hacking around with MLIR, I wanted to produce diagnostics that are specifically tailored to a particular region or block. However, I quickly discovered that mlir::Region::getLoc() actually returns the parent location, and the mlir::Block itself doesn’t store any location information, despite the fact that the parser does have such information.

Is there any specific reason for this?

An operation can have multiple regions, each containing many operations, so I believe it would be useful to have information about block locations at least, and the region location could refer to the first block.

1 Like