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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 14 13:53:48 PST 2023


Author: Kazu Hirata
Date: 2023-01-14T13:53:40-08:00
New Revision: b53e0d1b341f142e6d27e53058141d283837fbbd

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

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

Added: 
    

Modified: 
    clang/lib/Frontend/PrecompiledPreamble.cpp
    llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
    llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    llvm/lib/Transforms/Scalar/LoopFuse.cpp
    mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
    mlir/include/mlir/Tools/PDLL/AST/Nodes.h
    mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/PrecompiledPreamble.cpp b/clang/lib/Frontend/PrecompiledPreamble.cpp
index 17f960f47b787..579a0b8b614de 100644
--- a/clang/lib/Frontend/PrecompiledPreamble.cpp
+++ b/clang/lib/Frontend/PrecompiledPreamble.cpp
@@ -100,7 +100,7 @@ class MissingFileCollector : public PPCallbacks {
                           OptionalFileEntryRef File, StringRef SearchPath,
                           StringRef RelativePath, const Module *Imported,
                           SrcMgr::CharacteristicKind FileType) override {
-    // File is None if it wasn't found.
+    // File is std::nullopt if it wasn't found.
     // (We have some false negatives if PP recovered e.g. <foo> -> "foo")
     if (File)
       return;

diff  --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 12fbac99ee413..6113f78aeb4ee 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -454,7 +454,7 @@ class SegmentBuilder {
 
   /// Emit segments for active regions which end before \p Loc.
   ///
-  /// \p Loc: The start location of the next region. If None, all active
+  /// \p Loc: The start location of the next region. If std::nullopt, all active
   /// regions are completed.
   /// \p FirstCompletedRegion: Index of the first completed region.
   void completeRegionsUntil(std::optional<LineColPair> Loc,

diff  --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
index 0c1c6e14b02bf..ea3403aa799ad 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
@@ -144,8 +144,8 @@ class AArch64InstructionSelector : public InstructionSelector {
                                    Register Scalar,
                                    MachineIRBuilder &MIRBuilder) const;
 
-  /// Emit a lane insert into \p DstReg, or a new vector register if None is
-  /// provided.
+  /// Emit a lane insert into \p DstReg, or a new vector register if
+  /// std::nullopt is provided.
   ///
   /// The lane inserted into is defined by \p LaneIdx. The vector source
   /// register is given by \p SrcReg. The register containing the element is

diff  --git a/llvm/lib/Transforms/Scalar/LoopFuse.cpp b/llvm/lib/Transforms/Scalar/LoopFuse.cpp
index 714bb94c5449a..0eecec3737366 100644
--- a/llvm/lib/Transforms/Scalar/LoopFuse.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopFuse.cpp
@@ -885,8 +885,8 @@ struct LoopFuser {
           // Check if the candidates have identical tripcounts (first value of
           // pair), and if not check the 
diff erence in the tripcounts between
           // the loops (second value of pair). The 
diff erence is not equal to
-          // None iff the loops iterate a constant number of times, and have a
-          // single exit.
+          // std::nullopt iff the loops iterate a constant number of times, and
+          // have a single exit.
           std::pair<bool, std::optional<unsigned>> IdenticalTripCountRes =
               haveIdenticalTripCounts(*FC0, *FC1);
           bool SameTripCount = IdenticalTripCountRes.first;

diff  --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 3be4ee72cd5a5..f85e607f893fa 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -264,7 +264,8 @@ using CopyCallbackFn =
     std::function<LogicalResult(OpBuilder &b, Value src, Value dst)>;
 
 struct LinalgPromotionOptions {
-  /// Indices of subViews to promote. If `None`, try to promote all operands.
+  /// Indices of subViews to promote. If `std::nullopt`, try to promote all
+  /// operands.
   std::optional<DenseSet<unsigned>> operandsToPromote = std::nullopt;
   LinalgPromotionOptions &setOperandsToPromote(ArrayRef<int64_t> operands) {
     operandsToPromote = DenseSet<unsigned>();
@@ -292,7 +293,7 @@ struct LinalgPromotionOptions {
     useFullTileBuffersDefault = use;
     return *this;
   }
-  /// Alignment of promoted buffer. If `None` do not specify alignment.
+  /// Alignment of promoted buffer. If `std::nullopt` do not specify alignment.
   std::optional<unsigned> alignment = std::nullopt;
   LinalgPromotionOptions &setAlignment(unsigned align) {
     alignment = align;
@@ -304,9 +305,9 @@ struct LinalgPromotionOptions {
     useAlloca = use;
     return *this;
   }
-  /// Callback function to do the allocation of the promoted buffer. If None,
-  /// then the default allocation scheme of allocating a memref<?xi8> buffer
-  /// followed by a view operation is used.
+  /// Callback function to do the allocation of the promoted buffer. If
+  /// std::nullopt, then the default allocation scheme of allocating a
+  /// memref<?xi8> buffer followed by a view operation is used.
   std::optional<AllocBufferCallbackFn> allocationFn = std::nullopt;
   std::optional<DeallocBufferCallbackFn> deallocationFn = std::nullopt;
   LinalgPromotionOptions &
@@ -317,7 +318,7 @@ struct LinalgPromotionOptions {
     return *this;
   }
   /// Callback function to do the copy of data to and from the promoted
-  /// subview. If None then a memref.copy is used.
+  /// subview. If std::nullopt then a memref.copy is used.
   std::optional<CopyCallbackFn> copyInFn = std::nullopt;
   std::optional<CopyCallbackFn> copyOutFn = std::nullopt;
   LinalgPromotionOptions &setCopyInOutFns(CopyCallbackFn const &copyIn,

diff  --git a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
index 8a07cf9f87acd..0a34f8085321b 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Nodes.h
@@ -681,8 +681,8 @@ class Decl : public Node {
   /// PatternDecl.
   const Name *name;
 
-  /// The documentation comment attached to this decl. Defaults to None if
-  /// the comment is unset/unknown.
+  /// The documentation comment attached to this decl. Defaults to std::nullopt
+  /// if the comment is unset/unknown.
   std::optional<StringRef> docComment;
 };
 

diff  --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
index 56743424b95ef..bd226d5ed7d20 100644
--- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
+++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp
@@ -1382,7 +1382,7 @@ void FlatAffineValueConstraints::swapVar(unsigned posA, unsigned posB) {
       getVarKindAt(posB) == VarKind::Local)
     return;
 
-  // Treat value of a local variable as None.
+  // Treat value of a local variable as std::nullopt.
   if (getVarKindAt(posA) == VarKind::Local)
     values[posB] = std::nullopt;
   else if (getVarKindAt(posB) == VarKind::Local)


        


More information about the llvm-commits mailing list