And convert it to std::optional while updating.
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;
}
/// 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;
};