[llvm] 595f1a6 - [llvm] Use std::nullopt instead of None in comments (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 4 19:47:19 PST 2022


Author: Kazu Hirata
Date: 2022-12-04T19:47:13-08:00
New Revision: 595f1a6aaf5465fd71884b1557b4451be4e6a282

URL: https://github.com/llvm/llvm-project/commit/595f1a6aaf5465fd71884b1557b4451be4e6a282
DIFF: https://github.com/llvm/llvm-project/commit/595f1a6aaf5465fd71884b1557b4451be4e6a282.diff

LOG: [llvm] Use std::nullopt instead of None in comments (NFC)

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/Analysis/BranchProbabilityInfo.h
    llvm/include/llvm/Analysis/LoopAccessAnalysis.h
    llvm/include/llvm/BinaryFormat/Dwarf.h
    llvm/include/llvm/CodeGen/GlobalISel/Utils.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
    llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
    llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
    llvm/include/llvm/DebugInfo/GSYM/LineTable.h
    llvm/include/llvm/DebugInfo/Symbolize/Markup.h
    llvm/include/llvm/IR/Attributes.h
    llvm/include/llvm/IR/Constants.h
    llvm/include/llvm/IR/DebugInfoMetadata.h
    llvm/include/llvm/IR/Operator.h
    llvm/include/llvm/Object/Minidump.h
    llvm/include/llvm/Support/Program.h
    llvm/include/llvm/Testing/Support/SupportHelpers.h
    llvm/include/llvm/Transforms/Utils/LoopUtils.h
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
    llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/lib/DebugInfo/Symbolize/Markup.cpp
    llvm/lib/FileCheck/FileCheckImpl.h
    llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
    llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp
    llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
    llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
    llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h
    llvm/lib/Transforms/IPO/Attributor.cpp
    llvm/lib/Transforms/IPO/AttributorAttributes.cpp
    llvm/lib/Transforms/IPO/IROutliner.cpp
    llvm/lib/Transforms/Scalar/Scalarizer.cpp
    llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
index 51c6ef3fccd9e..66074f445e1ab 100644
--- a/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
+++ b/llvm/include/llvm/Analysis/BranchProbabilityInfo.h
@@ -371,7 +371,7 @@ class BranchProbabilityInfo {
 
   /// Iterates over all edges leading from \p SrcBB to \p Successors and
   /// returns maximum of all estimated weights. If at least one edge has unknown
-  /// estimated weight None is returned.
+  /// estimated weight std::nullopt is returned.
   template <class IterT>
   Optional<uint32_t>
   getMaxEstimatedEdgeWeight(const LoopBlock &SrcBB,

diff  --git a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
index ee5e3f74b41ca..67a7f9ce0bc05 100644
--- a/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
+++ b/llvm/include/llvm/Analysis/LoopAccessAnalysis.h
@@ -452,7 +452,7 @@ class RuntimePointerChecking {
   // pairs that can be used to prove that there are no vectorization-preventing
   // dependencies at runtime. There are is a vectorization-preventing dependency
   // if any pointer-
diff erence is <u VF * InterleaveCount * access size. Returns
-  // None if pointer-
diff erence checks cannot be used.
+  // std::nullopt if pointer-
diff erence checks cannot be used.
   std::optional<ArrayRef<PointerDiffInfo>> getDiffChecks() const {
     if (!CanUseDiffCheck)
       return std::nullopt;

diff  --git a/llvm/include/llvm/BinaryFormat/Dwarf.h b/llvm/include/llvm/BinaryFormat/Dwarf.h
index 2b49c375acb37..72e008d8a92c7 100644
--- a/llvm/include/llvm/BinaryFormat/Dwarf.h
+++ b/llvm/include/llvm/BinaryFormat/Dwarf.h
@@ -694,8 +694,8 @@ inline uint8_t getUnitLengthFieldByteSize(DwarfFormat Format) {
 ///
 /// \param Form DWARF form to get the fixed byte size for.
 /// \param Params DWARF parameters to help interpret forms.
-/// \returns std::optional<uint8_t> value with the fixed byte size or None if
-/// \p Form doesn't have a fixed byte size.
+/// \returns std::optional<uint8_t> value with the fixed byte size or
+/// std::nullopt if \p Form doesn't have a fixed byte size.
 std::optional<uint8_t> getFixedFormByteSize(dwarf::Form Form,
                                             FormParams Params);
 

diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
index 213891c149643..c236aa7f2457a 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
@@ -473,7 +473,7 @@ bool isConstantOrConstantVector(MachineInstr &MI,
 
 /// Determines if \p MI defines a constant integer or a splat vector of
 /// constant integers.
-/// \returns the scalar constant or None.
+/// \returns the scalar constant or std::nullopt.
 Optional<APInt> isConstantOrConstantSplatVector(MachineInstr &MI,
                                                 const MachineRegisterInfo &MRI);
 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
index aad46b945adf1..278a1b871a977 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
@@ -51,12 +51,12 @@ class DWARFAcceleratorTable {
 
   public:
     /// Returns the Offset of the Compilation Unit associated with this
-    /// Accelerator Entry or None if the Compilation Unit offset is not recorded
-    /// in this Accelerator Entry.
+    /// Accelerator Entry or std::nullopt if the Compilation Unit offset is not
+    /// recorded in this Accelerator Entry.
     virtual std::optional<uint64_t> getCUOffset() const = 0;
 
     /// Returns the Tag of the Debug Info Entry associated with this
-    /// Accelerator Entry or None if the Tag is not recorded in this
+    /// Accelerator Entry or std::nullopt if the Tag is not recorded in this
     /// Accelerator Entry.
     virtual std::optional<dwarf::Tag> getTag() const = 0;
 
@@ -126,9 +126,9 @@ class AppleAcceleratorTable : public DWARFAcceleratorTable {
     std::optional<uint64_t> getCUOffset() const override;
 
     /// Returns the Section Offset of the Debug Info Entry associated with this
-    /// Accelerator Entry or None if the DIE offset is not recorded in this
-    /// Accelerator Entry. The returned offset is relative to the start of the
-    /// Section containing the DIE.
+    /// Accelerator Entry or std::nullopt if the DIE offset is not recorded in
+    /// this Accelerator Entry. The returned offset is relative to the start of
+    /// the Section containing the DIE.
     std::optional<uint64_t> getDIESectionOffset() const;
 
     std::optional<dwarf::Tag> getTag() const override;
@@ -292,12 +292,12 @@ class DWARFDebugNames : public DWARFAcceleratorTable {
     std::optional<dwarf::Tag> getTag() const override { return tag(); }
 
     /// Returns the Index into the Compilation Unit list of the owning Name
-    /// Index or None if this Accelerator Entry does not have an associated
-    /// Compilation Unit. It is up to the user to verify that the returned Index
-    /// is valid in the owning NameIndex (or use getCUOffset(), which will
-    /// handle that check itself). Note that entries in NameIndexes which index
-    /// just a single Compilation Unit are implicitly associated with that unit,
-    /// so this function will return 0 even without an explicit
+    /// Index or std::nullopt if this Accelerator Entry does not have an
+    /// associated Compilation Unit. It is up to the user to verify that the
+    /// returned Index is valid in the owning NameIndex (or use getCUOffset(),
+    /// which will handle that check itself). Note that entries in NameIndexes
+    /// which index just a single Compilation Unit are implicitly associated
+    /// with that unit, so this function will return 0 even without an explicit
     /// DW_IDX_compile_unit attribute.
     std::optional<uint64_t> getCUIndex() const;
 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
index 9dfe95aa7131e..6f25964ef42b1 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
@@ -187,7 +187,7 @@ class RegisterLocations {
   ///
   /// \param RegNum the register number to find a location for.
   ///
-  /// \returns A location if one is available for \a RegNum, or llvm::None
+  /// \returns A location if one is available for \a RegNum, or std::nullopt
   /// otherwise.
   std::optional<UnwindLocation> getRegisterLocation(uint32_t RegNum) const {
     auto Pos = Locations.find(RegNum);

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
index 90f59138fc19d..421b84d644db6 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -149,8 +149,8 @@ class DWARFDie {
   ///
   /// \param Attrs an array of DWARF attribute to look for.
   /// \returns an optional that has a valid DWARFFormValue for the first
-  /// matching attribute in Attrs, or None if none of the attributes in Attrs
-  /// exist in this DIE.
+  /// matching attribute in Attrs, or std::nullopt if none of the attributes in
+  /// Attrs exist in this DIE.
   std::optional<DWARFFormValue> find(ArrayRef<dwarf::Attribute> Attrs) const;
 
   /// Extract the first value of any attribute in Attrs from this DIE and
@@ -159,9 +159,9 @@ class DWARFDie {
   ///
   /// \param Attrs an array of DWARF attribute to look for.
   /// \returns an optional that has a valid DWARFFormValue for the first
-  /// matching attribute in Attrs, or None if none of the attributes in Attrs
-  /// exist in this DIE or in any DW_AT_specification or DW_AT_abstract_origin
-  /// DIEs.
+  /// matching attribute in Attrs, or std::nullopt if none of the attributes in
+  /// Attrs exist in this DIE or in any DW_AT_specification or
+  /// DW_AT_abstract_origin DIEs.
   std::optional<DWARFFormValue>
   findRecursively(ArrayRef<dwarf::Attribute> Attrs) const;
 

diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
index e9944a1fbee62..5a78003b803ae 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
@@ -129,8 +129,8 @@ class DWARFFormValue {
   ///
   /// \param Kind The kind of path to extract.
   ///
-  /// \returns A valid string value on success, or llvm::None if the form class
-  /// is not FC_Constant, or if the file index is not valid.
+  /// \returns A valid string value on success, or std::nullopt if the form
+  /// class is not FC_Constant, or if the file index is not valid.
   std::optional<std::string>
   getAsFile(DILineInfoSpecifier::FileLineInfoKind Kind) const;
 

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
index f2ac33be3bbe1..5c0ab87dca303 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/GsymReader.h
@@ -137,7 +137,7 @@ class GsymReader {
   ///
   /// \param Index An index into the file table.
   /// \returns An optional FileInfo that will be valid if the file index is
-  /// valid, or llvm::None if the file index is out of bounds,
+  /// valid, or std::nullopt if the file index is out of bounds,
   std::optional<FileEntry> getFile(uint32_t Index) const {
     if (Index < Files.size())
       return Files[Index];
@@ -204,7 +204,7 @@ class GsymReader {
   ///
   /// \param Index A index into the address table.
   /// \returns A resolved virtual address for adddress in the address table
-  /// or llvm::None if Index is out of bounds.
+  /// or std::nullopt if Index is out of bounds.
   std::optional<uint64_t> getAddress(size_t Index) const;
 
 protected:
@@ -236,7 +236,7 @@ class GsymReader {
   ///
   /// \param Index An index into the AddrOffsets array.
   /// \returns An virtual address that matches the original object file for the
-  /// address as the specified index, or llvm::None if Index is out of bounds.
+  /// address as the specified index, or std::nullopt if Index is out of bounds.
   template <class T>
   std::optional<uint64_t> addressForIndex(size_t Index) const {
     ArrayRef<T> AIO = getAddrOffsets<T>();

diff  --git a/llvm/include/llvm/DebugInfo/GSYM/LineTable.h b/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
index a27019fc769da..7749e5e4fbb3b 100644
--- a/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
+++ b/llvm/include/llvm/DebugInfo/GSYM/LineTable.h
@@ -169,7 +169,7 @@ class LineTable {
   /// Return the first line entry if the line table isn't empty.
   ///
   /// \returns An optional line entry with the first line entry if the line
-  /// table isn't empty, or llvm::None if the line table is emtpy.
+  /// table isn't empty, or std::nullopt if the line table is emtpy.
   std::optional<LineEntry> first() const {
     if (Lines.empty())
       return std::nullopt;
@@ -178,7 +178,7 @@ class LineTable {
   /// Return the last line entry if the line table isn't empty.
   ///
   /// \returns An optional line entry with the last line entry if the line
-  /// table isn't empty, or llvm::None if the line table is emtpy.
+  /// table isn't empty, or std::nullopt if the line table is emtpy.
   std::optional<LineEntry> last() const {
     if (Lines.empty())
       return std::nullopt;

diff  --git a/llvm/include/llvm/DebugInfo/Symbolize/Markup.h b/llvm/include/llvm/DebugInfo/Symbolize/Markup.h
index c6242267f1e25..37e1d2748e31c 100644
--- a/llvm/include/llvm/DebugInfo/Symbolize/Markup.h
+++ b/llvm/include/llvm/DebugInfo/Symbolize/Markup.h
@@ -78,7 +78,7 @@ class MarkupParser {
   /// Calling nextNode() may invalidate the contents of the node returned by the
   /// previous call.
   ///
-  /// \returns the next markup node or None if none remain.
+  /// \returns the next markup node or std::nullopt if none remain.
   std::optional<MarkupNode> nextNode();
 
   bool isSGR(const MarkupNode &Node) const {

diff  --git a/llvm/include/llvm/IR/Attributes.h b/llvm/include/llvm/IR/Attributes.h
index 505b42b948ff4..cb7900343d670 100644
--- a/llvm/include/llvm/IR/Attributes.h
+++ b/llvm/include/llvm/IR/Attributes.h
@@ -235,8 +235,8 @@ class Attribute {
   /// Returns the minimum value for the vscale_range attribute.
   unsigned getVScaleRangeMin() const;
 
-  /// Returns the maximum value for the vscale_range attribute or None when
-  /// unknown.
+  /// Returns the maximum value for the vscale_range attribute or std::nullopt
+  /// when unknown.
   std::optional<unsigned> getVScaleRangeMax() const;
 
   // Returns the unwind table kind.
@@ -1105,8 +1105,8 @@ class AttrBuilder {
   /// invalid if the Kind is not present in the builder.
   Attribute getAttribute(StringRef Kind) const;
 
-  /// Return raw (possibly packed/encoded) value of integer attribute or None if
-  /// not set.
+  /// Return raw (possibly packed/encoded) value of integer attribute or
+  /// std::nullopt if not set.
   std::optional<uint64_t> getRawIntAttr(Attribute::AttrKind Kind) const;
 
   /// Retrieve the alignment attribute, if it exists.
@@ -1151,7 +1151,8 @@ class AttrBuilder {
   /// Retrieve the inalloca type.
   Type *getInAllocaType() const { return getTypeAttr(Attribute::InAlloca); }
 
-  /// Retrieve the allocsize args, or None if the attribute does not exist.
+  /// Retrieve the allocsize args, or std::nullopt if the attribute does not
+  /// exist.
   std::optional<std::pair<unsigned, std::optional<unsigned>>> getAllocSizeArgs()
       const;
 

diff  --git a/llvm/include/llvm/IR/Constants.h b/llvm/include/llvm/IR/Constants.h
index b3b46385c90fe..d39445832f790 100644
--- a/llvm/include/llvm/IR/Constants.h
+++ b/llvm/include/llvm/IR/Constants.h
@@ -1213,7 +1213,7 @@ class ConstantExpr : public Constant {
   /// Getelementptr form.  Value* is only accepted for convenience;
   /// all elements must be Constants.
   ///
-  /// \param InRangeIndex the inrange index if present or None.
+  /// \param InRangeIndex the inrange index if present or std::nullopt.
   /// \param OnlyIfReducedTy see \a getWithOperands() docs.
   static Constant *
   getGetElementPtr(Type *Ty, Constant *C, ArrayRef<Constant *> IdxList,

diff  --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 534de3d72b659..c85c21ddd9f15 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -860,8 +860,8 @@ class DIBasicType : public DIType {
 
   enum class Signedness { Signed, Unsigned };
 
-  /// Return the signedness of this type, or None if this type is neither
-  /// signed nor unsigned.
+  /// Return the signedness of this type, or std::nullopt if this type is
+  /// neither signed nor unsigned.
   std::optional<Signedness> getSignedness() const;
 
   static bool classof(const Metadata *MD) {
@@ -2552,8 +2552,8 @@ class DIVariable : public DINode {
   /// Determines the size of the variable's type.
   std::optional<uint64_t> getSizeInBits() const;
 
-  /// Return the signedness of this variable's type, or None if this type is
-  /// neither signed nor unsigned.
+  /// Return the signedness of this variable's type, or std::nullopt if this
+  /// type is neither signed nor unsigned.
   std::optional<DIBasicType::Signedness> getSignedness() const {
     if (auto *BT = dyn_cast<DIBasicType>(getType()))
       return BT->getSignedness();

diff  --git a/llvm/include/llvm/IR/Operator.h b/llvm/include/llvm/IR/Operator.h
index 2c2c86385bf3d..ed52535c0b6e9 100644
--- a/llvm/include/llvm/IR/Operator.h
+++ b/llvm/include/llvm/IR/Operator.h
@@ -393,8 +393,8 @@ class GEPOperator
     return SubclassOptionalData & IsInBounds;
   }
 
-  /// Returns the offset of the index with an inrange attachment, or None if
-  /// none.
+  /// Returns the offset of the index with an inrange attachment, or
+  /// std::nullopt if none.
   Optional<unsigned> getInRangeIndex() const {
     if (SubclassOptionalData >> 1 == 0)
       return std::nullopt;

diff  --git a/llvm/include/llvm/Object/Minidump.h b/llvm/include/llvm/Object/Minidump.h
index 4a0e8844e0e56..e45d4de0090de 100644
--- a/llvm/include/llvm/Object/Minidump.h
+++ b/llvm/include/llvm/Object/Minidump.h
@@ -40,8 +40,8 @@ class MinidumpFile : public Binary {
     return getData().slice(Stream.Location.RVA, Stream.Location.DataSize);
   }
 
-  /// Returns the raw contents of the stream of the given type, or None if the
-  /// file does not contain a stream of this type.
+  /// Returns the raw contents of the stream of the given type, or std::nullopt
+  /// if the file does not contain a stream of this type.
   std::optional<ArrayRef<uint8_t>>
   getRawStream(minidump::StreamType Type) const;
 

diff  --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h
index 5f1058920cd43..5aeb943266d0c 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -117,7 +117,7 @@ namespace sys {
       ///< If the array is empty, no redirections are performed.
       ///< Otherwise, the inferior process's stdin(0), stdout(1), and stderr(2)
       ///< will be redirected to the corresponding paths, if the optional path
-      ///< is present (not \c llvm::None).
+      ///< is present (not \c std::nullopt).
       ///< When an empty path is passed in, the corresponding file descriptor
       ///< will be disconnected (ie, /dev/null'd) in a portable way.
       unsigned SecondsToWait = 0, ///< If non-zero, this specifies the amount

diff  --git a/llvm/include/llvm/Testing/Support/SupportHelpers.h b/llvm/include/llvm/Testing/Support/SupportHelpers.h
index b1c59cf97f7f0..2745e06e249c1 100644
--- a/llvm/include/llvm/Testing/Support/SupportHelpers.h
+++ b/llvm/include/llvm/Testing/Support/SupportHelpers.h
@@ -99,7 +99,7 @@ template <class InnerMatcher> class ValueIsMatcher {
 } // namespace detail
 
 /// Matches an llvm::Optional<T> with a value that conforms to an inner matcher.
-/// To match llvm::None you could use Eq(llvm::None).
+/// To match std::nullopt you could use Eq(std::nullopt).
 template <class InnerMatcher>
 detail::ValueIsMatcher<InnerMatcher> ValueIs(const InnerMatcher &ValueMatcher) {
   return detail::ValueIsMatcher<InnerMatcher>(ValueMatcher);

diff  --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index 54d98c64a37e8..5f7b839b7a859 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -225,7 +225,7 @@ SmallVector<Instruction *, 8> findDefsUsedOutsideOfLoop(Loop *L);
 /// Find a combination of metadata ("llvm.loop.vectorize.width" and
 /// "llvm.loop.vectorize.scalable.enable") for a loop and use it to construct a
 /// ElementCount. If the metadata "llvm.loop.vectorize.width" cannot be found
-/// then None is returned.
+/// then std::nullopt is returned.
 Optional<ElementCount>
 getOptionalElementCountLoopAttribute(const Loop *TheLoop);
 
@@ -309,8 +309,8 @@ void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
 /// Returns a loop's estimated trip count based on branch weight metadata.
 /// In addition if \p EstimatedLoopInvocationWeight is not null it is
 /// initialized with weight of loop's latch leading to the exit.
-/// Returns 0 when the count is estimated to be 0, or None when a meaningful
-/// estimate can not be made.
+/// Returns 0 when the count is estimated to be 0, or std::nullopt when a
+/// meaningful estimate can not be made.
 Optional<unsigned>
 getLoopEstimatedTripCount(Loop *L,
                           unsigned *EstimatedLoopInvocationWeight = nullptr);

diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 74e563109d9bc..b65eceb37f4dc 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -1543,10 +1543,10 @@ bool InstrRefBasedLDV::transferDebugInstrRef(MachineInstr &MI,
     }
   }
 
-  // We, we have a value number or None. Tell the variable value tracker about
-  // it. The rest of this LiveDebugValues implementation acts exactly the same
-  // for DBG_INSTR_REFs as DBG_VALUEs (just, the former can refer to values that
-  // aren't immediately available).
+  // We, we have a value number or std::nullopt. Tell the variable value tracker
+  // about it. The rest of this LiveDebugValues implementation acts exactly the
+  // same for DBG_INSTR_REFs as DBG_VALUEs (just, the former can refer to values
+  // that aren't immediately available).
   DbgValueProperties Properties(Expr, false, false);
   SmallVector<DbgOpID> DbgOpIDs;
   if (NewID)

diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
index 27438da368ffa..9d0f4d021ae39 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h
@@ -1127,11 +1127,11 @@ class InstrRefBasedLDV : public LDVImpl {
     uint64_t InstrNum;
     /// Block where DBG_PHI occurred.
     MachineBasicBlock *MBB;
-    /// The value number read by the DBG_PHI -- or None if it didn't refer to
-    /// a value.
+    /// The value number read by the DBG_PHI -- or std::nullopt if it didn't
+    /// refer to a value.
     Optional<ValueIDNum> ValueRead;
-    /// Register/Stack location the DBG_PHI reads -- or None if it referred to
-    /// something unexpected.
+    /// Register/Stack location the DBG_PHI reads -- or std::nullopt if it
+    /// referred to something unexpected.
     Optional<LocIdx> ReadLoc;
 
     operator unsigned() const { return InstrNum; }
@@ -1229,7 +1229,7 @@ class InstrRefBasedLDV : public LDVImpl {
   /// forming another mini-ssa problem to solve.
   /// \p Here the position of a DBG_INSTR_REF seeking a machine value number
   /// \p InstrNum Debug instruction number defined by DBG_PHI instructions.
-  /// \returns The machine value number at position Here, or None.
+  /// \returns The machine value number at position Here, or std::nullopt.
   Optional<ValueIDNum> resolveDbgPHIs(MachineFunction &MF,
                                       const ValueTable *MLiveOuts,
                                       const ValueTable *MLiveIns,

diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 5e56330ee732c..548766792e6b2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -716,7 +716,7 @@ DWARFDebugLine::ParsingState::handleSpecialOpcode(uint8_t Opcode,
 }
 
 /// Parse a ULEB128 using the specified \p Cursor. \returns the parsed value on
-/// success, or None if \p Cursor is in a failing state.
+/// success, or std::nullopt if \p Cursor is in a failing state.
 template <typename T>
 static std::optional<T> parseULEB128(DWARFDataExtractor &Data,
                                      DataExtractor::Cursor &Cursor) {

diff  --git a/llvm/lib/DebugInfo/Symbolize/Markup.cpp b/llvm/lib/DebugInfo/Symbolize/Markup.cpp
index ae3e24c0d5008..a8e74afc8fc28 100644
--- a/llvm/lib/DebugInfo/Symbolize/Markup.cpp
+++ b/llvm/lib/DebugInfo/Symbolize/Markup.cpp
@@ -110,7 +110,7 @@ void MarkupParser::flush() {
 }
 
 // Finds and returns the next valid markup element in the given line. Returns
-// None if the line contains no valid elements.
+// std::nullopt if the line contains no valid elements.
 std::optional<MarkupNode> MarkupParser::parseElement(StringRef Line) {
   while (true) {
     // Find next element using begin and end markers.

diff  --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h
index ccfcda60b1c32..556be6b8bb0f9 100644
--- a/llvm/lib/FileCheck/FileCheckImpl.h
+++ b/llvm/lib/FileCheck/FileCheckImpl.h
@@ -265,16 +265,16 @@ class NumericVariable {
   /// format.
   ExpressionFormat ImplicitFormat;
 
-  /// Value of numeric variable, if defined, or None otherwise.
+  /// Value of numeric variable, if defined, or std::nullopt otherwise.
   Optional<ExpressionValue> Value;
 
-  /// The input buffer's string from which Value was parsed, or None.  See
-  /// comments on getStringValue for a discussion of the None case.
+  /// The input buffer's string from which Value was parsed, or std::nullopt.
+  /// See comments on getStringValue for a discussion of the None case.
   Optional<StringRef> StrValue;
 
-  /// Line number where this variable is defined, or None if defined before
-  /// input is parsed. Used to determine whether a variable is defined on the
-  /// same line as a given use.
+  /// Line number where this variable is defined, or std::nullopt if defined
+  /// before input is parsed. Used to determine whether a variable is defined on
+  /// the same line as a given use.
   Optional<size_t> DefLineNumber;
 
 public:
@@ -296,9 +296,9 @@ class NumericVariable {
   Optional<ExpressionValue> getValue() const { return Value; }
 
   /// \returns the input buffer's string from which this variable's value was
-  /// parsed, or None if the value is not yet defined or was not parsed from the
-  /// input buffer.  For example, the value of @LINE is not parsed from the
-  /// input buffer, and some numeric variables are parsed from the command
+  /// parsed, or std::nullopt if the value is not yet defined or was not parsed
+  /// from the input buffer.  For example, the value of @LINE is not parsed from
+  /// the input buffer, and some numeric variables are parsed from the command
   /// line instead.
   Optional<StringRef> getStringValue() const { return StrValue; }
 
@@ -318,8 +318,8 @@ class NumericVariable {
     StrValue = std::nullopt;
   }
 
-  /// \returns the line number where this variable is defined, if any, or None
-  /// if defined before input is parsed.
+  /// \returns the line number where this variable is defined, if any, or
+  /// std::nullopt if defined before input is parsed.
   Optional<size_t> getDefLineNumber() const { return DefLineNumber; }
 };
 
@@ -672,9 +672,9 @@ class Pattern {
 
   Check::FileCheckType CheckTy;
 
-  /// Line number for this CHECK pattern or None if it is an implicit pattern.
-  /// Used to determine whether a variable definition is made on an earlier
-  /// line to the one with this CHECK.
+  /// Line number for this CHECK pattern or std::nullopt if it is an implicit
+  /// pattern. Used to determine whether a variable definition is made on an
+  /// earlier line to the one with this CHECK.
   Optional<size_t> LineNumber;
 
   /// Ignore case while matching if set to true.
@@ -717,7 +717,7 @@ class Pattern {
   /// holding a diagnostic against \p SM if parsing fails. If substitution was
   /// successful, sets \p DefinedNumericVariable to point to the class
   /// representing the numeric variable defined in this numeric substitution
-  /// block, or None if this block does not define any variable.
+  /// block, or std::nullopt if this block does not define any variable.
   static Expected<std::unique_ptr<Expression>> parseNumericSubstitutionBlock(
       StringRef Expr, Optional<NumericVariable *> &DefinedNumericVariable,
       bool IsLegacyLineExpr, Optional<size_t> LineNumber,

diff  --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 51a2503c080f3..ac3665068ac72 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -689,7 +689,8 @@ static Optional<unsigned> findMainViewFileID(const FunctionRecord &Function) {
 }
 
 /// Check if SourceFile is the file that contains the definition of
-/// the Function. Return the ID of the file in that case or None otherwise.
+/// the Function. Return the ID of the file in that case or std::nullopt
+/// otherwise.
 static Optional<unsigned> findMainViewFileID(StringRef SourceFile,
                                              const FunctionRecord &Function) {
   Optional<unsigned> I = findMainViewFileID(Function);

diff  --git a/llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp b/llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp
index 05919c8faf951..75abe9c53e3be 100644
--- a/llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp
+++ b/llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp
@@ -37,8 +37,8 @@ class AArch64CompressJumpTables : public MachineFunctionPass {
   MachineFunction *MF;
   SmallVector<int, 8> BlockInfo;
 
-  /// Returns the size in instructions of the block \p MBB, or None if we
-  /// couldn't get a safe upper bound.
+  /// Returns the size in instructions of the block \p MBB, or std::nullopt if
+  /// we couldn't get a safe upper bound.
   std::optional<int> computeBlockSize(MachineBasicBlock &MBB);
 
   /// Gather information about the function, returns false if we can't perform

diff  --git a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
index 24ec9b2e3655c..d7812b84ca201 100644
--- a/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
+++ b/llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
@@ -1237,7 +1237,7 @@ bool isLegalSMRDEncodedSignedOffset(const MCSubtargetInfo &ST,
 uint64_t convertSMRDOffsetUnits(const MCSubtargetInfo &ST, uint64_t ByteOffset);
 
 /// \returns The encoding that will be used for \p ByteOffset in the
-/// SMRD offset field, or None if it won't fit. On GFX9 and GFX10
+/// SMRD offset field, or std::nullopt if it won't fit. On GFX9 and GFX10
 /// S_LOAD instructions have a signed offset, on other subtargets it is
 /// unsigned. S_BUFFER has an unsigned offset for all subtargets.
 Optional<int64_t> getSMRDEncodedOffset(const MCSubtargetInfo &ST,

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
index 4428c4f50fee1..dfc0409434de3 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp
@@ -191,10 +191,10 @@ void PPCELFStreamer::emitGOTToPCRelLabel(const MCInst &Inst) {
 // <MCInst SOME_LOAD <MCOperand Reg:22> <MCOperand Imm:0> <MCOperand Reg:282>
 //   <MCOperand Expr:(.Lpcrel@<<invalid>>)>>
 // The above is a pair of such instructions and this function will not return
-// None for either one of them. In both cases we are looking for the last
-// operand <MCOperand Expr:(.Lpcrel@<<invalid>>)> which needs to be an MCExpr
-// and has the flag MCSymbolRefExpr::VK_PPC_PCREL_OPT. After that we just look
-// at the opcode and in the case of PLDpc we will return true. For the load
+// std::nullopt for either one of them. In both cases we are looking for the
+// last operand <MCOperand Expr:(.Lpcrel@<<invalid>>)> which needs to be an
+// MCExpr and has the flag MCSymbolRefExpr::VK_PPC_PCREL_OPT. After that we just
+// look at the opcode and in the case of PLDpc we will return true. For the load
 // (or store) this function will return false indicating it has found the second
 // instruciton in the pair.
 std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h
index 13a05b0e4561a..528b33e34beee 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h
@@ -55,7 +55,7 @@ class WebAssemblyFrameLowering final : public TargetFrameLowering {
                        const DebugLoc &DL) const;
 
   // Returns the index of the WebAssembly local to which the stack object
-  // FrameIndex in MF should be allocated, or None.
+  // FrameIndex in MF should be allocated, or std::nullopt.
   static std::optional<unsigned> getLocalForStackObject(MachineFunction &MF,
                                                         int FrameIndex);
 

diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index ebb5c47b31fdd..820a45408a82f 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -1074,8 +1074,8 @@ Attributor::getAssumedConstant(const IRPosition &IRP,
                                const AbstractAttribute &AA,
                                bool &UsedAssumedInformation) {
   // First check all callbacks provided by outside AAs. If any of them returns
-  // a non-null value that is 
diff erent from the associated value, or None, we
-  // assume it's simplified.
+  // a non-null value that is 
diff erent from the associated value, or
+  // std::nullopt, we assume it's simplified.
   for (auto &CB : SimplificationCallbacks.lookup(IRP)) {
     Optional<Value *> SimplifiedV = CB(IRP, &AA, UsedAssumedInformation);
     if (!SimplifiedV)
@@ -1104,8 +1104,8 @@ Optional<Value *> Attributor::getAssumedSimplified(const IRPosition &IRP,
                                                    bool &UsedAssumedInformation,
                                                    AA::ValueScope S) {
   // First check all callbacks provided by outside AAs. If any of them returns
-  // a non-null value that is 
diff erent from the associated value, or None, we
-  // assume it's simplified.
+  // a non-null value that is 
diff erent from the associated value, or
+  // std::nullopt, we assume it's simplified.
   for (auto &CB : SimplificationCallbacks.lookup(IRP))
     return CB(IRP, AA, UsedAssumedInformation);
 
@@ -1128,8 +1128,8 @@ bool Attributor::getAssumedSimplifiedValues(
     SmallVectorImpl<AA::ValueAndContext> &Values, AA::ValueScope S,
     bool &UsedAssumedInformation) {
   // First check all callbacks provided by outside AAs. If any of them returns
-  // a non-null value that is 
diff erent from the associated value, or None, we
-  // assume it's simplified.
+  // a non-null value that is 
diff erent from the associated value, or
+  // std::nullopt, we assume it's simplified.
   const auto &SimplificationCBs = SimplificationCallbacks.lookup(IRP);
   for (const auto &CB : SimplificationCBs) {
     Optional<Value *> CBResult = CB(IRP, AA, UsedAssumedInformation);

diff  --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index 4ce9611f1bf4b..cc667e511bf8a 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -9617,7 +9617,7 @@ struct AAFunctionReachabilityFunction : public AAFunctionReachability {
       Unreachable.erase(&Fn);
     }
 
-    /// If there is no information about the function None is returned.
+    /// If there is no information about the function std::nullopt is returned.
     Optional<bool> isCachedReachable(const Function &Fn) {
       // Assume that we can reach the function.
       // TODO: Be more specific with the unknown callee.

diff  --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index d4ff9f68852de..afa46f253bdb9 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1171,8 +1171,8 @@ static hash_code encodePHINodeData(PHINodeData &PND) {
 /// \param PN - The PHINode we are analyzing.
 /// \param Blocks - The blocks for the region we are analyzing.
 /// \param AggArgIdx - The argument \p PN will be stored into.
-/// \returns An optional holding the assigned canonical number, or None if
-/// there is some attribute of the PHINode blocking it from being used.
+/// \returns An optional holding the assigned canonical number, or std::nullopt
+/// if there is some attribute of the PHINode blocking it from being used.
 static Optional<unsigned> getGVNForPHINode(OutlinableRegion &Region,
                                            PHINode *PN,
                                            DenseSet<BasicBlock *> &Blocks,

diff  --git a/llvm/lib/Transforms/Scalar/Scalarizer.cpp b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
index 0316a14216841..3cab25649aca9 100644
--- a/llvm/lib/Transforms/Scalar/Scalarizer.cpp
+++ b/llvm/lib/Transforms/Scalar/Scalarizer.cpp
@@ -481,7 +481,8 @@ void ScalarizerVisitor::transferMetadataAndIRFlags(Instruction *Op,
 }
 
 // Try to fill in Layout from Ty, returning true on success.  Alignment is
-// the alignment of the vector, or None if the ABI default should be used.
+// the alignment of the vector, or std::nullopt if the ABI default should be
+// used.
 Optional<VectorLayout>
 ScalarizerVisitor::getVectorLayout(Type *Ty, Align Alignment,
                                    const DataLayout &DL) {

diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index 7c7307905e8d4..4c635579b865f 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -295,8 +295,8 @@ class LoopVectorizationPlanner {
       : OrigLoop(L), LI(LI), TLI(TLI), TTI(TTI), Legal(Legal), CM(CM), IAI(IAI),
         PSE(PSE), Hints(Hints), ORE(ORE) {}
 
-  /// Plan how to best vectorize, return the best VF and its cost, or None if
-  /// vectorization and interleaving should be avoided up front.
+  /// Plan how to best vectorize, return the best VF and its cost, or
+  /// std::nullopt if vectorization and interleaving should be avoided up front.
   Optional<VectorizationFactor> plan(ElementCount UserVF, unsigned UserIC);
 
   /// Use the VPlan-native path to plan how to best vectorize, return the best


        


More information about the llvm-commits mailing list