@@ -171,10 +171,9 @@ static LogicalResult verifyInitializationAttribute(Operation *op,
171
171
// / In the format string, all `{}` are replaced by Placeholders, except if the
172
172
// / `{` is escaped by `{{` - then it doesn't start a placeholder.
173
173
template <class ArgType >
174
- FailureOr<SmallVector<ReplacementItem>>
175
- parseFormatString (StringRef toParse, ArgType fmtArgs,
176
- std::optional<llvm::function_ref<mlir::InFlightDiagnostic()>>
177
- emitError = {}) {
174
+ FailureOr<SmallVector<ReplacementItem>> parseFormatString (
175
+ StringRef toParse, ArgType fmtArgs,
176
+ llvm::function_ref<mlir::InFlightDiagnostic()> emitError = {}) {
178
177
SmallVector<ReplacementItem> items;
179
178
180
179
// If there are not operands, the format string is not interpreted.
@@ -197,8 +196,7 @@ parseFormatString(StringRef toParse, ArgType fmtArgs,
197
196
continue ;
198
197
}
199
198
if (toParse.size () < 2 ) {
200
- return (*emitError)()
201
- << " expected '}' after unescaped '{' at end of string" ;
199
+ return emitError () << " expected '}' after unescaped '{' at end of string" ;
202
200
}
203
201
// toParse contains at least two characters and starts with `{`.
204
202
char nextChar = toParse[1 ];
@@ -214,8 +212,8 @@ parseFormatString(StringRef toParse, ArgType fmtArgs,
214
212
continue ;
215
213
}
216
214
217
- if (emitError. has_value () ) {
218
- return (* emitError) () << " expected '}' after unescaped '{'" ;
215
+ if (emitError) {
216
+ return emitError () << " expected '}' after unescaped '{'" ;
219
217
}
220
218
return failure ();
221
219
}
0 commit comments