diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h --- a/mlir/include/mlir/IR/Builders.h +++ b/mlir/include/mlir/IR/Builders.h @@ -231,12 +231,12 @@ class InsertionGuard { public: InsertionGuard(OpBuilder &builder) - : builder(builder), ip(builder.saveInsertionPoint()) {} - ~InsertionGuard() { builder.restoreInsertionPoint(ip); } + : builder(builder), savedIp(builder.savedInsertionPoint()) {} + ~InsertionGuard() { builder.restoreInsertionPoint(savedIp); } private: OpBuilder &builder; - OpBuilder::InsertPoint ip; + OpBuilder::InsertPoint savedIp; }; /// Reset the insertion point to no location. Creating an operation without a @@ -247,8 +247,8 @@ insertPoint = Block::iterator(); } - /// Return a saved insertion point. - InsertPoint saveInsertionPoint() const { + /// Returns the saved insertion point. + InsertPoint savedInsertionPoint() const { return InsertPoint(getInsertionBlock(), getInsertionPoint()); } diff --git a/mlir/lib/EDSC/Builders.cpp b/mlir/lib/EDSC/Builders.cpp --- a/mlir/lib/EDSC/Builders.cpp +++ b/mlir/lib/EDSC/Builders.cpp @@ -28,7 +28,7 @@ mlir::edsc::ScopedContext::ScopedContext(OpBuilder &builder, OpBuilder::InsertPoint newInsertPt, Location location) - : builder(builder), prevBuilderInsertPoint(builder.saveInsertionPoint()), + : builder(builder), prevBuilderInsertPoint(builder.savedInsertionPoint()), location(location), enclosingScopedContext(ScopedContext::getCurrentScopedContext()), nestedBuilder(nullptr) { diff --git a/mlir/lib/Parser/Parser.cpp b/mlir/lib/Parser/Parser.cpp --- a/mlir/lib/Parser/Parser.cpp +++ b/mlir/lib/Parser/Parser.cpp @@ -4685,7 +4685,7 @@ // Check for an empty region. if (entryArguments.empty() && consumeIf(Token::r_brace)) return success(); - auto currentPt = opBuilder.saveInsertionPoint(); + auto currentPt = opBuilder.savedInsertionPoint(); // Push a new named value scope. pushSSANameScope(isIsolatedNameScope);