[Mlir-commits] [mlir] 14ce58f - [mlir][python] llvm::Optional::value => operator*
Fangrui Song
llvmlistbot at llvm.org
Sun Dec 18 20:29:02 PST 2022
Author: Fangrui Song
Date: 2022-12-19T04:28:55Z
New Revision: 14ce58f3bff07abfa3bf080e722ad546d11ac300
URL: https://github.com/llvm/llvm-project/commit/14ce58f3bff07abfa3bf080e722ad546d11ac300
DIFF: https://github.com/llvm/llvm-project/commit/14ce58f3bff07abfa3bf080e722ad546d11ac300.diff
LOG: [mlir][python] llvm::Optional::value => operator*
And convert it to std::optional while updating.
Added:
Modified:
mlir/lib/Bindings/Python/IRCore.cpp
mlir/lib/Bindings/Python/IRModule.h
Removed:
################################################################################
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<pybind11::tuple> materializedNotes;
+ std::optional<pybind11::tuple> materializedNotes;
bool valid = true;
};
More information about the Mlir-commits
mailing list