[llvm] 1101159 - [DebugInfo] Use std::nullopt instead of None (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 21:11:56 PST 2022


Author: Kazu Hirata
Date: 2022-12-02T21:11:39-08:00
New Revision: 110115993cad38755afa0371caa87459a93d5451

URL: https://github.com/llvm/llvm-project/commit/110115993cad38755afa0371caa87459a93d5451
DIFF: https://github.com/llvm/llvm-project/commit/110115993cad38755afa0371caa87459a93d5451.diff

LOG: [DebugInfo] Use std::nullopt instead of None (NFC)

This patch mechanically replaces None with std::nullopt where the
compiler would warn if None were deprecated.  The intent is to reduce
the amount of manual work required in migrating from Optional to
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
    llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
    llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
    llvm/include/llvm/DebugInfo/GSYM/LineTable.h
    llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h
    llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
    llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
    llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
    llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
    llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
    llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
    llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
    llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
    llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
    llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
    llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
    llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
    llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
    llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
    llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
    llvm/lib/DebugInfo/GSYM/GsymReader.cpp
    llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
    llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
    llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
    llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
    llvm/lib/DebugInfo/Symbolize/Markup.cpp
    llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
index 4fbe7e835a8a9..ccaf6506abde3 100644
--- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
+++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h
@@ -249,7 +249,7 @@ class CodeViewRecordIO {
 
     Optional<uint32_t> bytesRemaining(uint32_t CurrentOffset) const {
       if (!MaxLength)
-        return None;
+        return std::nullopt;
       assert(CurrentOffset >= BeginOffset);
 
       uint32_t BytesUsed = CurrentOffset - BeginOffset;

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index 48df091412bf3..75a1a0b05b2a2 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -77,8 +77,8 @@ class UnwindLocation {
   // Constructors are private to force people to use the create static
   // functions.
   UnwindLocation(Location K)
-      : Kind(K), RegNum(InvalidRegisterNumber), Offset(0), AddrSpace(None),
-        Dereference(false) {}
+      : Kind(K), RegNum(InvalidRegisterNumber), Offset(0),
+        AddrSpace(std::nullopt), Dereference(false) {}
 
   UnwindLocation(Location K, uint32_t Reg, int32_t Off, Optional<uint32_t> AS,
                  bool Deref)
@@ -117,10 +117,10 @@ class UnwindLocation {
   /// false.
   static UnwindLocation
   createIsRegisterPlusOffset(uint32_t Reg, int32_t Off,
-                             Optional<uint32_t> AddrSpace = None);
+                             Optional<uint32_t> AddrSpace = std::nullopt);
   static UnwindLocation
   createAtRegisterPlusOffset(uint32_t Reg, int32_t Off,
-                             Optional<uint32_t> AddrSpace = None);
+                             Optional<uint32_t> AddrSpace = std::nullopt);
   /// Create a location whose value is the result of evaluating a DWARF
   /// expression. This allows complex expressions to be evaluated in order to
   /// unwind a register or CFA value.
@@ -190,7 +190,7 @@ class RegisterLocations {
   Optional<UnwindLocation> getRegisterLocation(uint32_t RegNum) const {
     auto Pos = Locations.find(RegNum);
     if (Pos == Locations.end())
-      return llvm::None;
+      return std::nullopt;
     return Pos->second;
   }
 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
index 9befcc0c41829..89c042a0287bc 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
@@ -47,7 +47,7 @@ class DWARFDebugInfoEntry {
   /// Returns index of the parent die.
   Optional<uint32_t> getParentIdx() const {
     if (ParentIdx == UINT32_MAX)
-      return None;
+      return std::nullopt;
 
     return ParentIdx;
   }
@@ -55,7 +55,7 @@ class DWARFDebugInfoEntry {
   /// Returns index of the sibling die.
   Optional<uint32_t> getSiblingIdx() const {
     if (SiblingIdx == 0)
-      return None;
+      return std::nullopt;
 
     return SiblingIdx;
   }

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
index d98cf9a6045a1..25be64d064bb6 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
@@ -116,7 +116,7 @@ class DWARFDebugMacro {
   }
 
   Error parseMacinfo(DWARFDataExtractor MacroData) {
-    return parseImpl(None, None, MacroData, /*IsMacro=*/false);
+    return parseImpl(std::nullopt, std::nullopt, MacroData, /*IsMacro=*/false);
   }
 
   /// Return whether the section has any entries.

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
index ea18642350884..0c97893396601 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
@@ -140,7 +140,7 @@ class DWARFExpression {
   };
 
   DWARFExpression(DataExtractor Data, uint8_t AddressSize,
-                  Optional<dwarf::DwarfFormat> Format = None)
+                  Optional<dwarf::DwarfFormat> Format = std::nullopt)
       : Data(Data), AddressSize(AddressSize), Format(Format) {
     assert(AddressSize == 8 || AddressSize == 4 || AddressSize == 2);
   }

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index c2c1df5b590b0..4969e671609f5 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -176,11 +176,11 @@ namespace dwarf {
 /// was valid and was a string.
 inline Optional<const char *> toString(const Optional<DWARFFormValue> &V) {
   if (!V)
-    return None;
+    return std::nullopt;
   Expected<const char*> E = V->getAsCString();
   if (!E) {
     consumeError(E.takeError());
-    return None;
+    return std::nullopt;
   }
   return *E;
 }
@@ -225,7 +225,7 @@ inline const char *toString(const Optional<DWARFFormValue> &V,
 inline Optional<uint64_t> toUnsigned(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsUnsignedConstant();
-  return None;
+  return std::nullopt;
 }
 
 /// Take an optional DWARFFormValue and extract a unsigned constant.
@@ -247,7 +247,7 @@ inline uint64_t toUnsigned(const Optional<DWARFFormValue> &V,
 inline Optional<uint64_t> toReference(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsReference();
-  return None;
+  return std::nullopt;
 }
 
 /// Take an optional DWARFFormValue and extract a reference.
@@ -269,7 +269,7 @@ inline uint64_t toReference(const Optional<DWARFFormValue> &V,
 inline Optional<int64_t> toSigned(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsSignedConstant();
-  return None;
+  return std::nullopt;
 }
 
 /// Take an optional DWARFFormValue and extract a signed integer.
@@ -290,14 +290,14 @@ inline int64_t toSigned(const Optional<DWARFFormValue> &V, int64_t Default) {
 inline Optional<uint64_t> toAddress(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsAddress();
-  return None;
+  return std::nullopt;
 }
 
 inline Optional<object::SectionedAddress>
 toSectionedAddress(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsSectionedAddress();
-  return None;
+  return std::nullopt;
 }
 
 /// Take an optional DWARFFormValue and extract a address.
@@ -318,7 +318,7 @@ inline uint64_t toAddress(const Optional<DWARFFormValue> &V, uint64_t Default) {
 inline Optional<uint64_t> toSectionOffset(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsSectionOffset();
-  return None;
+  return std::nullopt;
 }
 
 /// Take an optional DWARFFormValue and extract a section offset.
@@ -340,7 +340,7 @@ inline uint64_t toSectionOffset(const Optional<DWARFFormValue> &V,
 inline Optional<ArrayRef<uint8_t>> toBlock(const Optional<DWARFFormValue> &V) {
   if (V)
     return V->getAsBlock();
-  return None;
+  return std::nullopt;
 }
 
 } // end namespace dwarf

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
index 84c8d71b04fc4..e5fe14cfb19e2 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFListTable.h
@@ -114,7 +114,7 @@ class DWARFListTableHeader {
             DIDumpOptions DumpOpts = {}) const;
   Optional<uint64_t> getOffsetEntry(DataExtractor Data, uint32_t Index) const {
     if (Index >= HeaderData.OffsetEntryCount)
-      return None;
+      return std::nullopt;
 
     return getOffsetEntry(Data, getHeaderOffset() + getHeaderSize(Format), Format, Index);
   }

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
index e0ee437deb688..25ca5cc42720b 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
@@ -530,7 +530,7 @@ class DWARFUnit {
         });
     if (It != DieArray.end() && It->getOffset() == Offset)
       return It - DieArray.begin();
-    return None;
+    return std::nullopt;
   }
 
   uint32_t getLineTableOffset() const {

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
index fb48f7f9a93c6..d02184ff62eec 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/FunctionInfo.h
@@ -175,8 +175,8 @@ struct FunctionInfo {
   void clear() {
     Range = {0, 0};
     Name = 0;
-    OptLineTable = None;
-    Inline = None;
+    OptLineTable = std::nullopt;
+    Inline = std::nullopt;
   }
 };
 

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
index 4ad9990c372fb..d026d9b85a58d 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
@@ -141,7 +141,7 @@ class GsymReader {
   Optional<FileEntry> getFile(uint32_t Index) const {
     if (Index < Files.size())
       return Files[Index];
-    return llvm::None;
+    return std::nullopt;
   }
 
   /// Dump the entire Gsym data contained in this object.
@@ -242,7 +242,7 @@ class GsymReader {
     ArrayRef<T> AIO = getAddrOffsets<T>();
     if (Index < AIO.size())
       return AIO[Index] + Hdr->BaseAddress;
-    return llvm::None;
+    return std::nullopt;
   }
   /// Lookup an address offset in the AddrOffsets table.
   ///
@@ -262,7 +262,7 @@ class GsymReader {
     // Watch for addresses that fall between the gsym::Header::BaseAddress and
     // the first address offset.
     if (Iter == Begin && AddrOffset < *Begin)
-      return llvm::None;
+      return std::nullopt;
     if (Iter == End || AddrOffset < *Iter)
       --Iter;
     return std::distance(Begin, Iter);

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/LineTable.h b/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
index efb7b8dfd43b7..c0121a8787be8 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
@@ -172,7 +172,7 @@ class LineTable {
   /// table isn't empty, or llvm::None if the line table is emtpy.
   Optional<LineEntry> first() const {
     if (Lines.empty())
-      return llvm::None;
+      return std::nullopt;
     return Lines.front();
   }
   /// Return the last line entry if the line table isn't empty.
@@ -181,7 +181,7 @@ class LineTable {
   /// table isn't empty, or llvm::None if the line table is emtpy.
   Optional<LineEntry> last() const {
     if (Lines.empty())
-      return llvm::None;
+      return std::nullopt;
     return Lines.back();
   }
   void push(const LineEntry &LE) {

diff  --git a/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h b/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h
index 7924cffd640f5..69fcb4aa99941 100644
--- a/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h
+++ b/llvm/include/llvm/DebugInfo/PDB/Native/HashTable.h
@@ -248,7 +248,7 @@ class HashTable {
   /// from a real key to an internal key.
   template <typename Key, typename TraitsT>
   bool set_as(const Key &K, ValueT V, TraitsT &Traits) {
-    return set_as_internal(K, std::move(V), Traits, None);
+    return set_as_internal(K, std::move(V), Traits, std::nullopt);
   }
 
   template <typename Key, typename TraitsT>

diff  --git a/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h b/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
index a54f8f5d2db81..27c07f7942c7a 100644
--- a/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
+++ b/llvm/include/llvm/DebugInfo/Symbolize/MarkupFilter.h
@@ -33,7 +33,7 @@ class LLVMSymbolizer;
 class MarkupFilter {
 public:
   MarkupFilter(raw_ostream &OS, LLVMSymbolizer &Symbolizer,
-               Optional<bool> ColorsEnabled = llvm::None);
+               Optional<bool> ColorsEnabled = std::nullopt);
 
   /// Filters a line containing symbolizer markup and writes the human-readable
   /// results to the output stream.

diff  --git a/llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp b/llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
index 3ab7f722eaeea..f0ffb41142f6e 100644
--- a/llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/AppendingTypeTableBuilder.cpp
@@ -31,14 +31,14 @@ AppendingTypeTableBuilder::~AppendingTypeTableBuilder() = default;
 
 Optional<TypeIndex> AppendingTypeTableBuilder::getFirst() {
   if (empty())
-    return None;
+    return std::nullopt;
 
   return TypeIndex(TypeIndex::FirstNonSimpleIndex);
 }
 
 Optional<TypeIndex> AppendingTypeTableBuilder::getNext(TypeIndex Prev) {
   if (++Prev == nextTypeIndex())
-    return None;
+    return std::nullopt;
   return Prev;
 }
 

diff  --git a/llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp b/llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
index 142af382efbaf..24e8b583201b9 100644
--- a/llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/GlobalTypeTableBuilder.cpp
@@ -34,14 +34,14 @@ GlobalTypeTableBuilder::~GlobalTypeTableBuilder() = default;
 
 Optional<TypeIndex> GlobalTypeTableBuilder::getFirst() {
   if (empty())
-    return None;
+    return std::nullopt;
 
   return TypeIndex(TypeIndex::FirstNonSimpleIndex);
 }
 
 Optional<TypeIndex> GlobalTypeTableBuilder::getNext(TypeIndex Prev) {
   if (++Prev == nextTypeIndex())
-    return None;
+    return std::nullopt;
   return Prev;
 }
 

diff  --git a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
index 1d49a1ed47128..5e6a2e05d9374 100644
--- a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
@@ -100,11 +100,11 @@ CVType LazyRandomTypeCollection::getType(TypeIndex Index) {
 
 Optional<CVType> LazyRandomTypeCollection::tryGetType(TypeIndex Index) {
   if (Index.isSimple())
-    return None;
+    return std::nullopt;
 
   if (auto EC = ensureTypeExists(Index)) {
     consumeError(std::move(EC));
-    return None;
+    return std::nullopt;
   }
 
   assert(contains(Index));
@@ -206,7 +206,7 @@ Optional<TypeIndex> LazyRandomTypeCollection::getFirst() {
   TypeIndex TI = TypeIndex::fromArrayIndex(0);
   if (auto EC = ensureTypeExists(TI)) {
     consumeError(std::move(EC));
-    return None;
+    return std::nullopt;
   }
   return TI;
 }
@@ -217,7 +217,7 @@ Optional<TypeIndex> LazyRandomTypeCollection::getNext(TypeIndex Prev) {
   // record exists, and if anything goes wrong, we must be at the end.
   if (auto EC = ensureTypeExists(Prev + 1)) {
     consumeError(std::move(EC));
-    return None;
+    return std::nullopt;
   }
 
   return Prev + 1;

diff  --git a/llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp b/llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
index 62d228599eae7..70a1878d13b1e 100644
--- a/llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
+++ b/llvm/lib/DebugInfo/CodeView/MergingTypeTableBuilder.cpp
@@ -35,14 +35,14 @@ MergingTypeTableBuilder::~MergingTypeTableBuilder() = default;
 
 Optional<TypeIndex> MergingTypeTableBuilder::getFirst() {
   if (empty())
-    return None;
+    return std::nullopt;
 
   return TypeIndex(TypeIndex::FirstNonSimpleIndex);
 }
 
 Optional<TypeIndex> MergingTypeTableBuilder::getNext(TypeIndex Prev) {
   if (++Prev == nextTypeIndex())
-    return None;
+    return std::nullopt;
   return Prev;
 }
 

diff  --git a/llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp b/llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
index 910a32730e39a..4cd19add06168 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeTableCollection.cpp
@@ -23,7 +23,7 @@ TypeTableCollection::TypeTableCollection(ArrayRef<ArrayRef<uint8_t>> Records)
 
 Optional<TypeIndex> TypeTableCollection::getFirst() {
   if (empty())
-    return None;
+    return std::nullopt;
   return TypeIndex::fromArrayIndex(0);
 }
 
@@ -31,7 +31,7 @@ Optional<TypeIndex> TypeTableCollection::getNext(TypeIndex Prev) {
   assert(contains(Prev));
   ++Prev;
   if (Prev.toArrayIndex() == size())
-    return None;
+    return std::nullopt;
   return Prev;
 }
 

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index e2ea5910932df..fb2aa7b61983c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -144,7 +144,7 @@ DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute Attr) const {
     if (AttributeSpecs[i].Attr == Attr)
       return i;
   }
-  return None;
+  return std::nullopt;
 }
 
 uint64_t DWARFAbbreviationDeclaration::getAttributeOffsetFromIndex(
@@ -180,7 +180,7 @@ DWARFAbbreviationDeclaration::getAttributeValueFromOffset(
   DWARFDataExtractor DebugInfoData = U.getDebugInfoExtractor();
   if (FormValue.extractValue(DebugInfoData, &Offset, U.getFormParams(), &U))
     return FormValue;
-  return None;
+  return std::nullopt;
 }
 
 Optional<DWARFFormValue>
@@ -191,7 +191,7 @@ DWARFAbbreviationDeclaration::getAttributeValue(const uint64_t DIEOffset,
   // any data so we can return quickly if it doesn't.
   Optional<uint32_t> MatchAttrIndex = findAttributeIndex(Attr);
   if (!MatchAttrIndex)
-    return None;
+    return std::nullopt;
 
   uint64_t Offset = getAttributeOffsetFromIndex(*MatchAttrIndex, DIEOffset, U);
 
@@ -227,5 +227,5 @@ Optional<size_t> DWARFAbbreviationDeclaration::getFixedAttributesByteSize(
     const DWARFUnit &U) const {
   if (FixedAttributeSize)
     return FixedAttributeSize->getByteSize(U);
-  return None;
+  return std::nullopt;
 }

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 5727b3bdb05c1..0e85160b57379 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -146,7 +146,7 @@ void AppleAcceleratorTable::Header::dump(ScopedPrinter &W) const {
 Optional<uint64_t> AppleAcceleratorTable::HeaderData::extractOffset(
     Optional<DWARFFormValue> Value) const {
   if (!Value)
-    return None;
+    return std::nullopt;
 
   switch (Value->getForm()) {
   case dwarf::DW_FORM_ref1:
@@ -280,7 +280,7 @@ AppleAcceleratorTable::Entry::lookup(HeaderData::AtomType Atom) const {
     if (std::get<0>(Tuple).first == Atom)
       return std::get<1>(Tuple);
   }
-  return None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> AppleAcceleratorTable::Entry::getDIESectionOffset() const {
@@ -294,10 +294,10 @@ Optional<uint64_t> AppleAcceleratorTable::Entry::getCUOffset() const {
 Optional<dwarf::Tag> AppleAcceleratorTable::Entry::getTag() const {
   Optional<DWARFFormValue> Tag = lookup(dwarf::DW_ATOM_die_tag);
   if (!Tag)
-    return None;
+    return std::nullopt;
   if (Optional<uint64_t> Value = Tag->getAsUnsignedConstant())
     return dwarf::Tag(*Value);
-  return None;
+  return std::nullopt;
 }
 
 AppleAcceleratorTable::ValueIterator::ValueIterator(
@@ -541,13 +541,13 @@ DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
     if (std::get<0>(Tuple).Index == Index)
       return std::get<1>(Tuple);
   }
-  return None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> DWARFDebugNames::Entry::getDIEUnitOffset() const {
   if (Optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_die_offset))
     return Off->getAsReferenceUVal();
-  return None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
@@ -557,13 +557,13 @@ Optional<uint64_t> DWARFDebugNames::Entry::getCUIndex() const {
   // implicitly refer to the single CU.
   if (NameIdx->getCUCount() == 1)
     return 0;
-  return None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> DWARFDebugNames::Entry::getCUOffset() const {
   Optional<uint64_t> Index = getCUIndex();
   if (!Index || *Index >= NameIdx->getCUCount())
-    return None;
+    return std::nullopt;
   return NameIdx->getCUOffset(*Index);
 }
 
@@ -767,7 +767,7 @@ LLVM_DUMP_METHOD void DWARFDebugNames::NameIndex::dump(ScopedPrinter &W) const {
 
   W.startLine() << "Hash table not present\n";
   for (const NameTableEntry &NTE : *this)
-    dumpName(W, NTE, None);
+    dumpName(W, NTE, std::nullopt);
 }
 
 Error DWARFDebugNames::extract() {
@@ -802,7 +802,7 @@ DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
       if (NTE.getString() == Key)
         return NTE.getEntryOffset();
     }
-    return None;
+    return std::nullopt;
   }
 
   // The Name Index has a Hash Table, so use that to speed up the search.
@@ -812,18 +812,18 @@ DWARFDebugNames::ValueIterator::findEntryOffsetInCurrentIndex() {
   uint32_t Bucket = *Hash % Hdr.BucketCount;
   uint32_t Index = CurrentIndex->getBucketArrayEntry(Bucket);
   if (Index == 0)
-    return None; // Empty bucket
+    return std::nullopt; // Empty bucket
 
   for (; Index <= Hdr.NameCount; ++Index) {
     uint32_t Hash = CurrentIndex->getHashArrayEntry(Index);
     if (Hash % Hdr.BucketCount != Bucket)
-      return None; // End of bucket
+      return std::nullopt; // End of bucket
 
     NameTableEntry NTE = CurrentIndex->getNameTableEntry(Index);
     if (NTE.getString() == Key)
       return NTE.getEntryOffset();
   }
-  return None;
+  return std::nullopt;
 }
 
 bool DWARFDebugNames::ValueIterator::getEntryAtCurrentOffset() {

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index aaa2ded1ccb87..e1d74310a51a4 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -330,8 +330,8 @@ static void dumpLoclistsSection(raw_ostream &OS, DIDumpOptions DumpOpts,
     if (DumpOffset) {
       if (DumpOffset >= Offset && DumpOffset < EndOffset) {
         Offset = *DumpOffset;
-        Loc.dumpLocationList(&Offset, OS, /*BaseAddr=*/None, MRI, Obj, nullptr,
-                             DumpOpts, /*Indent=*/0);
+        Loc.dumpLocationList(&Offset, OS, /*BaseAddr=*/std::nullopt, MRI, Obj,
+                             nullptr, DumpOpts, /*Indent=*/0);
         OS << "\n";
         return;
       }
@@ -450,8 +450,8 @@ void DWARFContext::dump(
     if (*Off) {
       uint64_t Offset = **Off;
       Loc.dumpLocationList(&Offset, OS,
-                           /*BaseAddr=*/None, getRegisterInfo(), *DObj, nullptr,
-                           LLDumpOpts, /*Indent=*/0);
+                           /*BaseAddr=*/std::nullopt, getRegisterInfo(), *DObj,
+                           nullptr, LLDumpOpts, /*Indent=*/0);
       OS << "\n";
     } else {
       Loc.dumpRange(0, Data.getData().size(), OS, getRegisterInfo(), *DObj,
@@ -616,7 +616,7 @@ void DWARFContext::dump(
     const auto &CUs = compile_units();
     auto I = CUs.begin();
     if (I == CUs.end())
-      return None;
+      return std::nullopt;
     return (*I)->getAddrOffsetSectionItem(Index);
   };
 
@@ -1157,7 +1157,7 @@ getExpressionFrameOffset(ArrayRef<uint8_t> Expr,
       return Offset;
     // Fallthrough. Do not accept ex. (DW_OP_breg W29, DW_OP_stack_value)
   }
-  return None;
+  return std::nullopt;
 }
 
 void DWARFContext::addLocalsForDie(DWARFCompileUnit *CU, DWARFDie Subprogram,

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
index 5f93c40379a8c..ff6ed2b667561 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp
@@ -72,7 +72,7 @@ Optional<uint64_t>
 DWARFDataExtractor::getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
                                       uint64_t PCRelOffset) const {
   if (Encoding == dwarf::DW_EH_PE_omit)
-    return None;
+    return std::nullopt;
 
   uint64_t Result = 0;
   uint64_t OldOffset = *Offset;
@@ -86,7 +86,7 @@ DWARFDataExtractor::getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
       Result = getUnsigned(Offset, getAddressSize());
       break;
     default:
-      return None;
+      return std::nullopt;
     }
     break;
   case dwarf::DW_EH_PE_uleb128:
@@ -114,7 +114,7 @@ DWARFDataExtractor::getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
     Result = getRelocatedValue(8, Offset);
     break;
   default:
-    return None;
+    return std::nullopt;
   }
   // Then add relative offset, if required
   switch (Encoding & 0x70) {
@@ -130,7 +130,7 @@ DWARFDataExtractor::getEncodedPointer(uint64_t *Offset, uint8_t Encoding,
   case dwarf::DW_EH_PE_aligned:
   default:
     *Offset = OldOffset;
-    return None;
+    return std::nullopt;
   }
 
   return Result;

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
index ee54fc7548033..3ea3818e7cc33 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp
@@ -122,7 +122,7 @@ void DWARFDebugAbbrev::parse() const {
       break;
     AbbrDeclSets.insert(I, std::make_pair(CUAbbrOffset, std::move(AbbrDecls)));
   }
-  Data = None;
+  Data = std::nullopt;
 }
 
 void DWARFDebugAbbrev::dump(raw_ostream &OS) const {

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
index 81fac4763ec1e..fa13491e83b9d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp
@@ -179,7 +179,7 @@ Expected<uint64_t> DWARFDebugAddrTable::getAddrEntry(uint32_t Index) const {
 
 Optional<uint64_t> DWARFDebugAddrTable::getFullLength() const {
   if (Length == 0)
-    return None;
+    return std::nullopt;
   return Length + dwarf::getUnitLengthFieldByteSize(Format);
 }
 

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
index 3bf80dcb2c9cd..2d3b14a5570c9 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -50,15 +50,15 @@ UnwindLocation UnwindLocation::createUndefined() { return {Undefined}; }
 UnwindLocation UnwindLocation::createSame() { return {Same}; }
 
 UnwindLocation UnwindLocation::createIsConstant(int32_t Value) {
-  return {Constant, InvalidRegisterNumber, Value, None, false};
+  return {Constant, InvalidRegisterNumber, Value, std::nullopt, false};
 }
 
 UnwindLocation UnwindLocation::createIsCFAPlusOffset(int32_t Offset) {
-  return {CFAPlusOffset, InvalidRegisterNumber, Offset, None, false};
+  return {CFAPlusOffset, InvalidRegisterNumber, Offset, std::nullopt, false};
 }
 
 UnwindLocation UnwindLocation::createAtCFAPlusOffset(int32_t Offset) {
-  return {CFAPlusOffset, InvalidRegisterNumber, Offset, None, true};
+  return {CFAPlusOffset, InvalidRegisterNumber, Offset, std::nullopt, true};
 }
 
 UnwindLocation
@@ -1052,7 +1052,7 @@ Error DWARFDebugFrame::parse(DWARFDataExtractor Data) {
     if (Length == 0) {
       auto Cie = std::make_unique<CIE>(
           IsDWARF64, StartOffset, 0, 0, SmallString<8>(), 0, 0, 0, 0, 0,
-          SmallString<8>(), 0, 0, None, None, Arch);
+          SmallString<8>(), 0, 0, std::nullopt, std::nullopt, Arch);
       CIEs[StartOffset] = Cie.get();
       Entries.push_back(std::move(Cie));
       break;

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 96f7529014df5..2bce28fe8a03f 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -81,7 +81,7 @@ bool DWARFDebugLine::Prologue::hasFileAtIndex(uint64_t FileIndex) const {
 
 Optional<uint64_t> DWARFDebugLine::Prologue::getLastValidFileIndex() const {
   if (FileNames.empty())
-    return None;
+    return std::nullopt;
   uint16_t DwarfVersion = getVersion();
   assert(DwarfVersion != 0 &&
          "line table prologue has no dwarf version information");
@@ -722,7 +722,7 @@ static Optional<T> parseULEB128(DWARFDataExtractor &Data,
   T Value = Data.getULEB128(Cursor);
   if (Cursor)
     return Value;
-  return None;
+  return std::nullopt;
 }
 
 Error DWARFDebugLine::LineTable::parse(
@@ -1333,11 +1333,11 @@ bool DWARFDebugLine::LineTable::lookupAddressRangeImpl(
 Optional<StringRef> DWARFDebugLine::LineTable::getSourceByIndex(uint64_t FileIndex,
                                                                 FileLineInfoKind Kind) const {
   if (Kind == FileLineInfoKind::None || !Prologue.hasFileAtIndex(FileIndex))
-    return None;
+    return std::nullopt;
   const FileNameEntry &Entry = Prologue.getFileNameEntry(FileIndex);
   if (auto E = dwarf::toString(Entry.Source))
     return StringRef(*E);
-  return None;
+  return std::nullopt;
 }
 
 static bool isPathAbsoluteOnWindowsOrPosix(const Twine &Path) {

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
index b68af4cfafefb..6a44052e3474d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
@@ -52,12 +52,12 @@ Expected<Optional<DWARFLocationExpression>>
 DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
   switch (E.Kind) {
   case dwarf::DW_LLE_end_of_list:
-    return None;
+    return std::nullopt;
   case dwarf::DW_LLE_base_addressx: {
     Base = LookupAddr(E.Value0);
     if (!Base)
       return createResolverError(E.Value0, E.Kind);
-    return None;
+    return std::nullopt;
   }
   case dwarf::DW_LLE_startx_endx: {
     Optional<SectionedAddress> LowPC = LookupAddr(E.Value0);
@@ -92,10 +92,10 @@ DWARFLocationInterpreter::Interpret(const DWARFLocationEntry &E) {
     return DWARFLocationExpression{Range, E.Loc};
   }
   case dwarf::DW_LLE_default_location:
-    return DWARFLocationExpression{None, E.Loc};
+    return DWARFLocationExpression{std::nullopt, E.Loc};
   case dwarf::DW_LLE_base_address:
     Base = SectionedAddress{E.Value0, E.SectionIndex};
-    return None;
+    return std::nullopt;
   case dwarf::DW_LLE_start_end:
     return DWARFLocationExpression{
         DWARFAddressRange{E.Value0, E.Value1, E.SectionIndex}, E.Loc};
@@ -130,7 +130,7 @@ bool DWARFLocationTable::dumpLocationList(uint64_t *Offset, raw_ostream &OS,
       BaseAddr, [U](uint32_t Index) -> Optional<SectionedAddress> {
         if (U)
           return U->getAddrOffsetSectionItem(Index);
-        return None;
+        return std::nullopt;
       });
   OS << format("0x%8.8" PRIx64 ": ", *Offset);
   Error E = visitLocationList(Offset, [&](const DWARFLocationEntry &E) {
@@ -187,7 +187,7 @@ Error DWARFLocationTable::visitAbsoluteLocationList(
 void DWARFDebugLoc::dump(raw_ostream &OS, const MCRegisterInfo *MRI,
                          const DWARFObject &Obj, DIDumpOptions DumpOpts,
                          Optional<uint64_t> DumpOffset) const {
-  auto BaseAddr = None;
+  auto BaseAddr = std::nullopt;
   unsigned Indent = 12;
   if (DumpOffset) {
     dumpLocationList(&*DumpOffset, OS, BaseAddr, MRI, Obj, nullptr, DumpOpts,
@@ -401,8 +401,8 @@ void DWARFDebugLoclists::dumpRange(uint64_t StartOffset, uint64_t Size,
     OS << Separator;
     Separator = "\n";
 
-    CanContinue = dumpLocationList(&Offset, OS, /*BaseAddr=*/None, MRI, Obj,
-                                   nullptr, DumpOpts, /*Indent=*/12);
+    CanContinue = dumpLocationList(&Offset, OS, /*BaseAddr=*/std::nullopt, MRI,
+                                   Obj, nullptr, DumpOpts, /*Indent=*/12);
     OS << '\n';
   }
 }

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 15a2d23c4fd2a..d6f0ee4312e8a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -251,17 +251,17 @@ bool DWARFDie::isSubroutineDIE() const {
 
 Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const {
   if (!isValid())
-    return None;
+    return std::nullopt;
   auto AbbrevDecl = getAbbreviationDeclarationPtr();
   if (AbbrevDecl)
     return AbbrevDecl->getAttributeValue(getOffset(), Attr, *U);
-  return None;
+  return std::nullopt;
 }
 
 Optional<DWARFFormValue>
 DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const {
   if (!isValid())
-    return None;
+    return std::nullopt;
   auto AbbrevDecl = getAbbreviationDeclarationPtr();
   if (AbbrevDecl) {
     for (auto Attr : Attrs) {
@@ -269,7 +269,7 @@ DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const {
         return Value;
     }
   }
-  return None;
+  return std::nullopt;
 }
 
 Optional<DWARFFormValue>
@@ -302,7 +302,7 @@ DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const {
         Worklist.push_back(D);
   }
 
-  return None;
+  return std::nullopt;
 }
 
 DWARFDie
@@ -348,7 +348,7 @@ Optional<uint64_t> DWARFDie::getLocBaseAttribute() const {
 Optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const {
   uint64_t Tombstone = dwarf::computeTombstoneAddress(U->getAddressByteSize());
   if (LowPC == Tombstone)
-    return None;
+    return std::nullopt;
   if (auto FormValue = find(DW_AT_high_pc)) {
     if (auto Address = FormValue->getAsAddress()) {
       // High PC is an address.
@@ -359,7 +359,7 @@ Optional<uint64_t> DWARFDie::getHighPC(uint64_t LowPC) const {
       return LowPC + *Offset;
     }
   }
-  return None;
+  return std::nullopt;
 }
 
 bool DWARFDie::getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC,
@@ -429,7 +429,7 @@ DWARFDie::getLocations(dwarf::Attribute Attr) const {
 
   if (Optional<ArrayRef<uint8_t>> Expr = Location->getAsBlock()) {
     return DWARFLocationExpressionsVector{
-        DWARFLocationExpression{None, to_vector<4>(*Expr)}};
+        DWARFLocationExpression{std::nullopt, to_vector<4>(*Expr)}};
   }
 
   return createStringError(
@@ -520,10 +520,10 @@ Optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
   case DW_TAG_array_type: {
     DWARFDie BaseType = getAttributeValueAsReferencedDie(DW_AT_type);
     if (!BaseType)
-      return None;
+      return std::nullopt;
     Optional<uint64_t> BaseSize = BaseType.getTypeSize(PointerSize);
     if (!BaseSize)
-      return None;
+      return std::nullopt;
     uint64_t Size = *BaseSize;
     for (DWARFDie Child : *this) {
       if (Child.getTag() != DW_TAG_subrange_type)
@@ -549,7 +549,7 @@ Optional<uint64_t> DWARFDie::getTypeSize(uint64_t PointerSize) {
       return BaseType.getTypeSize(PointerSize);
     break;
   }
-  return None;
+  return std::nullopt;
 }
 
 /// Helper to dump a DIE with all of its parents, but no siblings.

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index bd8c9d6b4ba92..99b92f11cfdb8 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -473,7 +473,7 @@ void DWARFFormValue::dump(raw_ostream &OS, DIDumpOptions DumpOpts) const {
     OS << format("0x%016" PRIx64, UValue);
     break;
   case DW_FORM_data16:
-    OS << format_bytes(ArrayRef<uint8_t>(Value.data, 16), None, 16, 16);
+    OS << format_bytes(ArrayRef<uint8_t>(Value.data, 16), std::nullopt, 16, 16);
     break;
   case DW_FORM_string:
     OS << '"';
@@ -669,22 +669,22 @@ Expected<const char *> DWARFFormValue::getAsCString() const {
 Optional<uint64_t> DWARFFormValue::getAsAddress() const {
   if (auto SA = getAsSectionedAddress())
     return SA->Address;
-  return None;
+  return std::nullopt;
 }
 
 Optional<object::SectionedAddress>
 DWARFFormValue::getAsSectionedAddress() const {
   if (!isFormClass(FC_Address))
-    return None;
+    return std::nullopt;
   bool AddrOffset = Form == dwarf::DW_FORM_LLVM_addrx_offset;
   if (Form == DW_FORM_GNU_addr_index || Form == DW_FORM_addrx || AddrOffset) {
 
     uint32_t Index = AddrOffset ? (Value.uval >> 32) : Value.uval;
     if (!U)
-      return None;
+      return std::nullopt;
     Optional<object::SectionedAddress> SA = U->getAddrOffsetSectionItem(Index);
     if (!SA)
-      return None;
+      return std::nullopt;
     if (AddrOffset)
       SA->Address += (Value.uval & 0xffffffff);
     return SA;
@@ -695,12 +695,12 @@ DWARFFormValue::getAsSectionedAddress() const {
 Optional<uint64_t> DWARFFormValue::getAsReference() const {
   if (auto R = getAsRelativeReference())
     return R->Unit ? R->Unit->getOffset() + R->Offset : R->Offset;
-  return None;
+  return std::nullopt;
 }
 
 Optional<DWARFFormValue::UnitOffset> DWARFFormValue::getAsRelativeReference() const {
   if (!isFormClass(FC_Reference))
-    return None;
+    return std::nullopt;
   switch (Form) {
   case DW_FORM_ref1:
   case DW_FORM_ref2:
@@ -708,27 +708,27 @@ Optional<DWARFFormValue::UnitOffset> DWARFFormValue::getAsRelativeReference() co
   case DW_FORM_ref8:
   case DW_FORM_ref_udata:
     if (!U)
-      return None;
+      return std::nullopt;
     return UnitOffset{const_cast<DWARFUnit*>(U), Value.uval};
   case DW_FORM_ref_addr:
   case DW_FORM_ref_sig8:
   case DW_FORM_GNU_ref_alt:
     return UnitOffset{nullptr, Value.uval};
   default:
-    return None;
+    return std::nullopt;
   }
 }
 
 Optional<uint64_t> DWARFFormValue::getAsSectionOffset() const {
   if (!isFormClass(FC_SectionOffset))
-    return None;
+    return std::nullopt;
   return Value.uval;
 }
 
 Optional<uint64_t> DWARFFormValue::getAsUnsignedConstant() const {
   if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
       Form == DW_FORM_sdata)
-    return None;
+    return std::nullopt;
   return Value.uval;
 }
 
@@ -736,7 +736,7 @@ Optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
   if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag)) ||
       (Form == DW_FORM_udata &&
        uint64_t(std::numeric_limits<int64_t>::max()) < Value.uval))
-    return None;
+    return std::nullopt;
   switch (Form) {
   case DW_FORM_data4:
     return int32_t(Value.uval);
@@ -754,26 +754,26 @@ Optional<int64_t> DWARFFormValue::getAsSignedConstant() const {
 Optional<ArrayRef<uint8_t>> DWARFFormValue::getAsBlock() const {
   if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc) &&
       Form != DW_FORM_data16)
-    return None;
+    return std::nullopt;
   return makeArrayRef(Value.data, Value.uval);
 }
 
 Optional<uint64_t> DWARFFormValue::getAsCStringOffset() const {
   if (!isFormClass(FC_String) && Form == DW_FORM_string)
-    return None;
+    return std::nullopt;
   return Value.uval;
 }
 
 Optional<uint64_t> DWARFFormValue::getAsReferenceUVal() const {
   if (!isFormClass(FC_Reference))
-    return None;
+    return std::nullopt;
   return Value.uval;
 }
 
 Optional<std::string>
 DWARFFormValue::getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const {
   if (U == nullptr || !isFormClass(FC_Constant))
-    return None;
+    return std::nullopt;
   DWARFUnit *DLU = const_cast<DWARFUnit *>(U)->getLinkedUnit();
   if (auto *LT = DLU->getContext().getLineTableForUnit(DLU)) {
     std::string FileName;
@@ -781,5 +781,5 @@ DWARFFormValue::getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const {
                                FileName))
       return FileName;
   }
-  return None;
+  return std::nullopt;
 }

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
index 8664e73623733..aca0932e0f617 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFTypePrinter.cpp
@@ -35,7 +35,7 @@ void DWARFTypePrinter::appendArrayType(const DWARFDie &D) {
         if ((DefaultLB =
                  LanguageLowerBound(static_cast<dwarf::SourceLanguage>(*LC))))
           if (LB && *LB == *DefaultLB)
-            LB = None;
+            LB = std::nullopt;
     if (!LB && !Count && !UB)
       OS << "[]";
     else if (!LB && (Count || UB) && DefaultLB)

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
index dfa2e9cc8c1eb..77b2b68ef62fc 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
@@ -215,12 +215,12 @@ DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const {
     if (IsDWO && hasSingleElement(R))
       return (*R.begin())->getAddrOffsetSectionItem(Index);
 
-    return None;
+    return std::nullopt;
   }
 
   uint64_t Offset = *AddrOffsetSectionBase + Index * getAddressByteSize();
   if (AddrOffsetSection->Data.size() < Offset + getAddressByteSize())
-    return None;
+    return std::nullopt;
   DWARFDataExtractor DA(Context.getDWARFObj(), *AddrOffsetSection,
                         IsLittleEndian, getAddressByteSize());
   uint64_t Section;
@@ -377,7 +377,7 @@ void DWARFUnit::clear() {
   BaseAddr.reset();
   RangeSectionBase = 0;
   LocSectionBase = 0;
-  AddrOffsetSectionBase = None;
+  AddrOffsetSectionBase = std::nullopt;
   SU = nullptr;
   clearDIEs(false);
   AddrDieMap.clear();
@@ -502,7 +502,7 @@ Error DWARFUnit::tryExtractDIEsIfNeeded(bool CUDieOnly) {
   if (Optional<uint64_t> DWOId = toUnsigned(UnitDie.find(DW_AT_GNU_dwo_id)))
     Header.setDWOId(*DWOId);
   if (!IsDWO) {
-    assert(AddrOffsetSectionBase == None);
+    assert(AddrOffsetSectionBase == std::nullopt);
     assert(RangeSectionBase == 0);
     assert(LocSectionBase == 0);
     AddrOffsetSectionBase = toSectionOffset(UnitDie.find(DW_AT_addr_base));
@@ -1138,7 +1138,7 @@ DWARFUnit::determineStringOffsetsTableContribution(DWARFDataExtractor &DA) {
   assert(!IsDWO);
   auto OptOffset = toSectionOffset(getUnitDIE().find(DW_AT_str_offsets_base));
   if (!OptOffset)
-    return None;
+    return std::nullopt;
   auto DescOrError =
       parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), *OptOffset);
   if (!DescOrError)
@@ -1157,7 +1157,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) {
     Offset = C->Offset;
   if (getVersion() >= 5) {
     if (DA.getData().data() == nullptr)
-      return None;
+      return std::nullopt;
     Offset += Header.getFormat() == dwarf::DwarfFormat::DWARF32 ? 8 : 16;
     // Look for a valid contribution at the given offset.
     auto DescOrError = parseDWARFStringOffsetsTableHeader(DA, Header.getFormat(), Offset);
@@ -1176,7 +1176,7 @@ DWARFUnit::determineStringOffsetsTableContributionDWO(DWARFDataExtractor & DA) {
     Desc = StrOffsetsContributionDescriptor(0, StringOffsetSection.Data.size(),
                                             4, Header.getFormat());
   else
-    return None;
+    return std::nullopt;
   auto DescOrError = Desc.validateContributionSize(DA);
   if (!DescOrError)
     return DescOrError.takeError();
@@ -1191,12 +1191,12 @@ Optional<uint64_t> DWARFUnit::getRnglistOffset(uint32_t Index) {
   if (Optional<uint64_t> Off = llvm::DWARFListTableHeader::getOffsetEntry(
           RangesData, RangeSectionBase, getFormat(), Index))
     return *Off + RangeSectionBase;
-  return None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> DWARFUnit::getLoclistOffset(uint32_t Index) {
   if (Optional<uint64_t> Off = llvm::DWARFListTableHeader::getOffsetEntry(
           LocTable->getData(), LocSectionBase, getFormat(), Index))
     return *Off + LocSectionBase;
-  return None;
+  return std::nullopt;
 }

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 2be2a12aa0256..26e92781c5fdd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -62,7 +62,7 @@ DWARFVerifier::DieRangeInfo::insert(const DWARFAddressRange &R) {
   }
 
   Ranges.insert(Pos, R);
-  return None;
+  return std::nullopt;
 }
 
 DWARFVerifier::DieRangeInfo::die_range_info_iterator

diff  --git a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
index f70e66ddcffae..b7e03e9885a37 100644
--- a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -140,7 +140,7 @@ getQualifiedNameIndex(DWARFDie &Die, uint64_t Language, GsymCreator &Gsym) {
 
   StringRef ShortName(Die.getName(DINameKind::ShortName));
   if (ShortName.empty())
-    return llvm::None;
+    return std::nullopt;
 
   // For C++ and ObjC, prepend names of all parent declaration contexts
   if (!(Language == dwarf::DW_LANG_C_plus_plus ||
@@ -346,7 +346,7 @@ static void convertFunctionLineTable(raw_ostream &Log, CUInfo &CUI,
   // If not line table rows were added, clear the line table so we don't encode
   // on in the GSYM file.
   if (FI.OptLineTable->empty())
-    FI.OptLineTable = llvm::None;
+    FI.OptLineTable = std::nullopt;
 }
 
 void DwarfTransformer::handleDie(raw_ostream &OS, CUInfo &CUI, DWARFDie Die) {

diff  --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index 0c585cc8d3066..352af91fa9574 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -213,14 +213,14 @@ Optional<uint64_t> GsymReader::getAddress(size_t Index) const {
   case 4: return addressForIndex<uint32_t>(Index);
   case 8: return addressForIndex<uint64_t>(Index);
   }
-  return llvm::None;
+  return std::nullopt;
 }
 
 Optional<uint64_t> GsymReader::getAddressInfoOffset(size_t Index) const {
   const auto NumAddrInfoOffsets = AddrInfoOffsets.size();
   if (Index < NumAddrInfoOffsets)
     return AddrInfoOffsets[Index];
-  return llvm::None;
+  return std::nullopt;
 }
 
 Expected<uint64_t>

diff  --git a/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp b/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
index f7c4637a8a5bf..54cbab88ae3e8 100644
--- a/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
+++ b/llvm/lib/DebugInfo/GSYM/InlineInfo.cpp
@@ -57,7 +57,7 @@ llvm::Optional<InlineInfo::InlineArray> InlineInfo::getInlineStack(uint64_t Addr
   InlineArray Result;
   if (getInlineStackHelper(*this, Addr, Result))
     return Result;
-  return llvm::None;
+  return std::nullopt;
 }
 
 /// Skip an InlineInfo object in the specified data at the specified offset.

diff  --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
index 35e0eca17c795..e41f4e3e3096f 100644
--- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp
@@ -409,7 +409,8 @@ Error LVBinaryReader::createInstructions(LVScope *Scope,
         std::string BufferCodes;
         raw_string_ostream StreamCodes(BufferCodes);
         StreamCodes << format_bytes(
-            ArrayRef<uint8_t>(Begin, Begin + BytesConsumed), None, 16, 16);
+            ArrayRef<uint8_t>(Begin, Begin + BytesConsumed), std::nullopt, 16,
+            16);
         dbgs() << "[" << hexValue((uint64_t)Begin) << "] "
                << "Size: " << format_decimal(BytesConsumed, 2) << " ("
                << formatv("{0}",

diff  --git a/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp b/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
index 99ec627fcd269..7eede122f669d 100644
--- a/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
+++ b/llvm/lib/DebugInfo/PDB/Native/NativeInlineSiteSymbol.cpp
@@ -57,7 +57,7 @@ findInlineeByTypeIndex(TypeIndex Id, ModuleDebugStreamRef &ModS) {
       if (Line.Header->Inlinee == Id)
         return Line;
   }
-  return None;
+  return std::nullopt;
 }
 
 std::string NativeInlineSiteSymbol::getName() const {
@@ -140,10 +140,10 @@ void NativeInlineSiteSymbol::getLineOffset(uint32_t OffsetInFunc,
         FileOffset = *NextFileOffset;
       if (NextLineOffset) {
         CurLineOffset = NextLineOffset;
-        NextLineOffset = None;
+        NextLineOffset = std::nullopt;
       }
       CodeOffsetBase = CodeOffsetEnd;
-      CodeOffsetEnd = NextFileOffset = None;
+      CodeOffsetEnd = NextFileOffset = std::nullopt;
     }
     return false;
   };

diff  --git a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
index dc793f07e21b5..8557c755c5f7e 100644
--- a/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/DIPrinter.cpp
@@ -34,7 +34,7 @@ class SourceCode {
   Optional<StringRef> load(StringRef FileName,
                            const Optional<StringRef> &EmbeddedSource) {
     if (Lines <= 0)
-      return None;
+      return std::nullopt;
 
     if (EmbeddedSource)
       return EmbeddedSource;
@@ -42,7 +42,7 @@ class SourceCode {
       ErrorOr<std::unique_ptr<MemoryBuffer>> BufOrErr =
           MemoryBuffer::getFile(FileName);
       if (!BufOrErr)
-        return None;
+        return std::nullopt;
       MemBuf = std::move(*BufOrErr);
       return MemBuf->getBuffer();
     }
@@ -50,7 +50,7 @@ class SourceCode {
 
   Optional<StringRef> pruneSource(const Optional<StringRef> &Source) {
     if (!Source)
-      return None;
+      return std::nullopt;
     size_t FirstLinePos = StringRef::npos, Pos = 0;
     for (int64_t L = 1; L <= LastLine; ++L, ++Pos) {
       if (L == FirstLine)
@@ -60,7 +60,7 @@ class SourceCode {
         break;
     }
     if (FirstLinePos == StringRef::npos)
-      return None;
+      return std::nullopt;
     return Source->substr(FirstLinePos, (Pos == StringRef::npos)
                                             ? StringRef::npos
                                             : Pos - FirstLinePos);

diff  --git a/llvm/lib/DebugInfo/Symbolize/Markup.cpp b/llvm/lib/DebugInfo/Symbolize/Markup.cpp
index aa8a89812227f..a6541162f4684 100644
--- a/llvm/lib/DebugInfo/Symbolize/Markup.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Markup.cpp
@@ -54,7 +54,7 @@ Optional<MarkupNode> MarkupParser::nextNode() {
   // The buffer is empty, so parse the next bit of the line.
 
   if (Line.empty())
-    return None;
+    return std::nullopt;
 
   if (!InProgressMultiline.empty()) {
     if (Optional<StringRef> MultilineEnd = parseMultiLineEnd(Line)) {
@@ -70,7 +70,7 @@ Optional<MarkupNode> MarkupParser::nextNode() {
     // The whole line is part of the multi-line element.
     llvm::append_range(InProgressMultiline, Line);
     Line = Line.drop_front(Line.size());
-    return None;
+    return std::nullopt;
   }
 
   // Find the first valid markup element, if any.
@@ -116,10 +116,10 @@ Optional<MarkupNode> MarkupParser::parseElement(StringRef Line) {
     // Find next element using begin and end markers.
     size_t BeginPos = Line.find("{{{");
     if (BeginPos == StringRef::npos)
-      return None;
+      return std::nullopt;
     size_t EndPos = Line.find("}}}", BeginPos + 3);
     if (EndPos == StringRef::npos)
-      return None;
+      return std::nullopt;
     EndPos += 3;
     MarkupNode Element;
     Element.Text = Line.slice(BeginPos, EndPos);
@@ -173,22 +173,22 @@ Optional<StringRef> MarkupParser::parseMultiLineBegin(StringRef Line) {
   // A multi-line begin marker must be the last one on the line.
   size_t BeginPos = Line.rfind("{{{");
   if (BeginPos == StringRef::npos)
-    return None;
+    return std::nullopt;
   size_t BeginTagPos = BeginPos + 3;
 
   // If there are any end markers afterwards, the begin marker cannot belong to
   // a multi-line element.
   size_t EndPos = Line.find("}}}", BeginTagPos);
   if (EndPos != StringRef::npos)
-    return None;
+    return std::nullopt;
 
   // Check whether the tag is registered multi-line.
   size_t EndTagPos = Line.find(':', BeginTagPos);
   if (EndTagPos == StringRef::npos)
-    return None;
+    return std::nullopt;
   StringRef Tag = Line.slice(BeginTagPos, EndTagPos);
   if (!MultilineTags.contains(Tag))
-    return None;
+    return std::nullopt;
   return Line.substr(BeginPos);
 }
 
@@ -197,7 +197,7 @@ Optional<StringRef> MarkupParser::parseMultiLineBegin(StringRef Line) {
 Optional<StringRef> MarkupParser::parseMultiLineEnd(StringRef Line) {
   size_t EndPos = Line.find("}}}");
   if (EndPos == StringRef::npos)
-    return None;
+    return std::nullopt;
   return Line.take_front(EndPos + 3);
 }
 

diff  --git a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
index 14618405630e2..0ec437e2c0025 100644
--- a/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/MarkupFilter.cpp
@@ -421,7 +421,7 @@ bool MarkupFilter::trySGR(const MarkupNode &Node) {
                       .Case("\033[35m", raw_ostream::Colors::MAGENTA)
                       .Case("\033[36m", raw_ostream::Colors::CYAN)
                       .Case("\033[37m", raw_ostream::Colors::WHITE)
-                      .Default(llvm::None);
+                      .Default(std::nullopt);
   if (SGRColor) {
     Color = *SGRColor;
     if (ColorsEnabled)
@@ -502,17 +502,17 @@ void MarkupFilter::printValue(Twine Value) {
 Optional<MarkupFilter::Module>
 MarkupFilter::parseModule(const MarkupNode &Element) const {
   if (!checkNumFieldsAtLeast(Element, 3))
-    return None;
+    return std::nullopt;
   ASSIGN_OR_RETURN_NONE(uint64_t, ID, parseModuleID(Element.Fields[0]));
   StringRef Name = Element.Fields[1];
   StringRef Type = Element.Fields[2];
   if (Type != "elf") {
     WithColor::error() << "unknown module type\n";
     reportLocation(Type.begin());
-    return None;
+    return std::nullopt;
   }
   if (!checkNumFields(Element, 4))
-    return None;
+    return std::nullopt;
   ASSIGN_OR_RETURN_NONE(SmallVector<uint8_t>, BuildID,
                         parseBuildID(Element.Fields[3]));
   return Module{ID, Name.str(), std::move(BuildID)};
@@ -521,24 +521,24 @@ MarkupFilter::parseModule(const MarkupNode &Element) const {
 Optional<MarkupFilter::MMap>
 MarkupFilter::parseMMap(const MarkupNode &Element) const {
   if (!checkNumFieldsAtLeast(Element, 3))
-    return None;
+    return std::nullopt;
   ASSIGN_OR_RETURN_NONE(uint64_t, Addr, parseAddr(Element.Fields[0]));
   ASSIGN_OR_RETURN_NONE(uint64_t, Size, parseSize(Element.Fields[1]));
   StringRef Type = Element.Fields[2];
   if (Type != "load") {
     WithColor::error() << "unknown mmap type\n";
     reportLocation(Type.begin());
-    return None;
+    return std::nullopt;
   }
   if (!checkNumFields(Element, 6))
-    return None;
+    return std::nullopt;
   ASSIGN_OR_RETURN_NONE(uint64_t, ID, parseModuleID(Element.Fields[3]));
   ASSIGN_OR_RETURN_NONE(std::string, Mode, parseMode(Element.Fields[4]));
   auto It = Modules.find(ID);
   if (It == Modules.end()) {
     WithColor::error() << "unknown module ID\n";
     reportLocation(Element.Fields[3].begin());
-    return None;
+    return std::nullopt;
   }
   ASSIGN_OR_RETURN_NONE(uint64_t, ModuleRelativeAddr,
                         parseAddr(Element.Fields[5]));
@@ -550,18 +550,18 @@ MarkupFilter::parseMMap(const MarkupNode &Element) const {
 Optional<uint64_t> MarkupFilter::parseAddr(StringRef Str) const {
   if (Str.empty()) {
     reportTypeError(Str, "address");
-    return None;
+    return std::nullopt;
   }
   if (all_of(Str, [](char C) { return C == '0'; }))
     return 0;
   if (!Str.startswith("0x")) {
     reportTypeError(Str, "address");
-    return None;
+    return std::nullopt;
   }
   uint64_t Addr;
   if (Str.drop_front(2).getAsInteger(16, Addr)) {
     reportTypeError(Str, "address");
-    return None;
+    return std::nullopt;
   }
   return Addr;
 }
@@ -571,7 +571,7 @@ Optional<uint64_t> MarkupFilter::parseModuleID(StringRef Str) const {
   uint64_t ID;
   if (Str.getAsInteger(0, ID)) {
     reportTypeError(Str, "module ID");
-    return None;
+    return std::nullopt;
   }
   return ID;
 }
@@ -581,7 +581,7 @@ Optional<uint64_t> MarkupFilter::parseSize(StringRef Str) const {
   uint64_t ID;
   if (Str.getAsInteger(0, ID)) {
     reportTypeError(Str, "size");
-    return None;
+    return std::nullopt;
   }
   return ID;
 }
@@ -591,7 +591,7 @@ Optional<uint64_t> MarkupFilter::parseFrameNumber(StringRef Str) const {
   uint64_t ID;
   if (Str.getAsInteger(10, ID)) {
     reportTypeError(Str, "frame number");
-    return None;
+    return std::nullopt;
   }
   return ID;
 }
@@ -601,7 +601,7 @@ Optional<SmallVector<uint8_t>> MarkupFilter::parseBuildID(StringRef Str) const {
   std::string Bytes;
   if (Str.empty() || Str.size() % 2 || !tryGetFromHex(Str, Bytes)) {
     reportTypeError(Str, "build ID");
-    return None;
+    return std::nullopt;
   }
   ArrayRef<uint8_t> BuildID(reinterpret_cast<const uint8_t *>(Bytes.data()),
                             Bytes.size());
@@ -612,7 +612,7 @@ Optional<SmallVector<uint8_t>> MarkupFilter::parseBuildID(StringRef Str) const {
 Optional<std::string> MarkupFilter::parseMode(StringRef Str) const {
   if (Str.empty()) {
     reportTypeError(Str, "mode");
-    return None;
+    return std::nullopt;
   }
 
   // Pop off each of r/R, w/W, and x/X from the front, in that order.
@@ -627,7 +627,7 @@ Optional<std::string> MarkupFilter::parseMode(StringRef Str) const {
   // If anything remains, then the string wasn't a mode.
   if (!Remainder.empty()) {
     reportTypeError(Str, "mode");
-    return None;
+    return std::nullopt;
   }
 
   // Normalize the mode.
@@ -639,7 +639,7 @@ Optional<MarkupFilter::PCType> MarkupFilter::parsePCType(StringRef Str) const {
       StringSwitch<Optional<MarkupFilter::PCType>>(Str)
           .Case("ra", MarkupFilter::PCType::ReturnAddress)
           .Case("pc", MarkupFilter::PCType::PreciseCode)
-          .Default(None);
+          .Default(std::nullopt);
   if (!Type)
     reportTypeError(Str, "PC type");
   return Type;


        


More information about the llvm-commits mailing list