[mlir][python] llvm::Optional::value => operator*
authorFangrui Song <i@maskray.me>
Mon, 19 Dec 2022 04:28:55 +0000 (04:28 +0000)
committerFangrui Song <i@maskray.me>
Mon, 19 Dec 2022 04:28:55 +0000 (04:28 +0000)
And convert it to std::optional while updating.

mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/IRModule.h

index b46fe44..794be97 100644 (file)
@@ -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;
 }
index 4738a6f..2492ad5 100644 (file)
@@ -302,7 +302,7 @@ private:
   /// If notes have been materialized from the diagnostic, then this will
   /// be populated with the corresponding objects (all castable to
   /// PyDiagnostic).
-  llvm::Optional<pybind11::tuple> materializedNotes;
+  std::optional<pybind11::tuple> materializedNotes;
   bool valid = true;
 };