diff options
| author | River Riddle <riverriddle@google.com> | 2019-10-30 11:13:52 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-10-30 11:14:30 -0700 |
| commit | 0568e952b6d1dc53f44c8eb5af167fc9d2e0bb34 (patch) | |
| tree | 8b4837d53c6d06c22f9bfbe54252568a61ef578f /mlir/lib/IR | |
| parent | cb40e36d3bb93e876ec6d05f128a23f26b952604 (diff) | |
| download | bcm5719-llvm-0568e952b6d1dc53f44c8eb5af167fc9d2e0bb34.tar.gz bcm5719-llvm-0568e952b6d1dc53f44c8eb5af167fc9d2e0bb34.zip | |
Add a utility accessor 'has_single_element' for ranges.
This provides an easy way to check if a range has a single element.
PiperOrigin-RevId: 277544647
Diffstat (limited to 'mlir/lib/IR')
| -rw-r--r-- | mlir/lib/IR/Module.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mlir/lib/IR/Module.cpp b/mlir/lib/IR/Module.cpp index 9f3bdaa854c..f55f960ffa2 100644 --- a/mlir/lib/IR/Module.cpp +++ b/mlir/lib/IR/Module.cpp @@ -87,7 +87,7 @@ LogicalResult ModuleOp::verify() { auto &bodyRegion = getOperation()->getRegion(0); // The body must contain a single basic block. - if (bodyRegion.empty() || std::next(bodyRegion.begin()) != bodyRegion.end()) + if (!has_single_element(bodyRegion)) return emitOpError("expected body region to have a single block"); // Check that the body has no block arguments. |

