[mlir] Deprecate OpPrintingFlags(std::nullopt_t) (NFC)#149546
Merged
kazutakahirata merged 1 commit intollvm:mainfrom Jul 18, 2025
Merged
Conversation
This patch deprecates OpPrintingFlags(std::nullopt_t) to avoid use of std::nullopt outside the context of std::optional.
Member
|
@llvm/pr-subscribers-mlir-core @llvm/pr-subscribers-mlir Author: Kazu Hirata (kazutakahirata) ChangesThis patch deprecates OpPrintingFlags(std::nullopt_t) to avoid use of Full diff: https://github.com/llvm/llvm-project/pull/149546.diff 3 Files Affected:
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index 75c3aea0792ac..883ece32967e4 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -115,7 +115,7 @@ class OpState {
MLIRContext *getContext() { return getOperation()->getContext(); }
/// Print the operation to the given stream.
- void print(raw_ostream &os, OpPrintingFlags flags = std::nullopt) {
+ void print(raw_ostream &os, OpPrintingFlags flags = {}) {
state->print(os, flags);
}
void print(raw_ostream &os, AsmState &asmState) {
diff --git a/mlir/include/mlir/IR/Operation.h b/mlir/include/mlir/IR/Operation.h
index 1c2c04e718bf7..fa8a4873572ce 100644
--- a/mlir/include/mlir/IR/Operation.h
+++ b/mlir/include/mlir/IR/Operation.h
@@ -318,7 +318,7 @@ class alignas(8) Operation final
/// take O(N) where N is the number of operations within the parent block.
bool isBeforeInBlock(Operation *other);
- void print(raw_ostream &os, const OpPrintingFlags &flags = std::nullopt);
+ void print(raw_ostream &os, const OpPrintingFlags &flags = {});
void print(raw_ostream &os, AsmState &state);
void dump();
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index 65e6d4f64e36c..5741cce509ced 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -1175,6 +1175,7 @@ class alignas(8) OperandStorage {
class OpPrintingFlags {
public:
OpPrintingFlags();
+ LLVM_DEPRECATED("Use OpPrintingFlags() instead", "OpPrintingFlags()")
OpPrintingFlags(std::nullopt_t) : OpPrintingFlags() {}
/// Enables the elision of large elements attributes by printing a lexically
|
kuhar
approved these changes
Jul 18, 2025
kuhar
reviewed
Jul 18, 2025
This was referenced Jul 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patch deprecates OpPrintingFlags(std::nullopt_t) to avoid use of
std::nullopt outside the context of std::optional.