diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp index b46fe44e9e19f..794be974284cd 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -841,7 +841,7 @@ py::tuple PyDiagnostic::getNotes() { materializedNotes = py::tuple(numNotes); for (intptr_t i = 0; i < numNotes; ++i) { MlirDiagnostic noteDiag = mlirDiagnosticGetNote(diagnostic, i); - materializedNotes.value()[i] = PyDiagnostic(noteDiag); + (*materializedNotes)[i] = PyDiagnostic(noteDiag); } return *materializedNotes; } diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h index 4738a6fae78cf..2492ad5d1f277 100644 --- a/mlir/lib/Bindings/Python/IRModule.h +++ b/mlir/lib/Bindings/Python/IRModule.h @@ -302,7 +302,7 @@ class PyDiagnostic { /// If notes have been materialized from the diagnostic, then this will /// be populated with the corresponding objects (all castable to /// PyDiagnostic). - llvm::Optional materializedNotes; + std::optional materializedNotes; bool valid = true; };