Skip to content

Commit 9d6cbc3

Browse files
[ADT] Deprecate MutableArrayRef(std::nullopt) (#146113)
ArrayRef(std::nullopt) just got deprecated. This patch does the same to MutableArrayRef(std::nullopt). Since there are only a couple of uses, this patch does migration and deprecation at the same time.
1 parent 71bc606 commit 9d6cbc3

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clang/lib/Serialization/ASTWriterDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ namespace clang {
302302
}
303303
MutableArrayRef<FunctionTemplateSpecializationInfo>
304304
getPartialSpecializations(FunctionTemplateDecl::Common *) {
305-
return std::nullopt;
305+
return {};
306306
}
307307

308308
template<typename DeclTy>

llvm/include/llvm/ADT/ArrayRef.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ namespace llvm {
304304
/*implicit*/ MutableArrayRef() = default;
305305

306306
/// Construct an empty MutableArrayRef from std::nullopt.
307-
/*implicit*/ MutableArrayRef(std::nullopt_t) : ArrayRef<T>() {}
307+
/*implicit*/ LLVM_DEPRECATED("Use {} or MutableArrayRef<T>() instead", "{}")
308+
MutableArrayRef(std::nullopt_t) : ArrayRef<T>() {}
308309

309310
/// Construct a MutableArrayRef from a single element.
310311
/*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef<T>(OneElt) {}

mlir/lib/IR/Diagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
727727
raw_ostream &os, llvm::SourceMgr &mgr, const llvm::MemoryBuffer *buf) {
728728
// If the buffer is invalid, return an empty list.
729729
if (!buf)
730-
return std::nullopt;
730+
return {};
731731
auto &expectedDiags = expectedDiagsPerFile[buf->getBufferIdentifier()];
732732

733733
// The number of the last line that did not correlate to a designator.

0 commit comments

Comments
 (0)