diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-04 19:47:13 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-04 19:47:13 -0800 |
commit | 595f1a6aaf5465fd71884b1557b4451be4e6a282 (patch) | |
tree | 54053944e3de7d5e1e51132cb5678a13d7e889d6 /llvm/lib | |
parent | 47edc70866920693d99e5b31014ba761a796d181 (diff) | |
download | llvm-595f1a6aaf5465fd71884b1557b4451be4e6a282.zip llvm-595f1a6aaf5465fd71884b1557b4451be4e6a282.tar.gz llvm-595f1a6aaf5465fd71884b1557b4451be4e6a282.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h | 10 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/Symbolize/Markup.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/FileCheck/FileCheckImpl.h | 30 | ||||
-rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64CompressJumpTables.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/PowerPC/MCTargetDesc/PPCELFStreamer.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/Attributor.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/AttributorAttributes.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/IROutliner.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Scalar/Scalarizer.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | 4 |
15 files changed, 49 insertions, 47 deletions
diff --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp index 74e5631..b65eceb 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 27438da..9d0f4d0 100644 --- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h +++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h @@ -1127,11 +1127,11 @@ private: 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 @@ private: /// 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 5e56330..5487667 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 ae3e24c0..a8e74af 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 ccfcda6..556be6b 100644 --- a/llvm/lib/FileCheck/FileCheckImpl.h +++ b/llvm/lib/FileCheck/FileCheckImpl.h @@ -265,16 +265,16 @@ private: /// 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 @@ public: 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 @@ public: 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 @@ public: /// 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 51a2503..ac36650 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 05919c8..75abe9c 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 24ec9b2..d7812b8 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 4428c4f..dfc0409 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 13a05b0..528b33e 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyFrameLowering.h @@ -55,7 +55,7 @@ public: 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 ebb5c47..820a454 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 different from the associated value, or None, we - // assume it's simplified. + // a non-null value that is different 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 different from the associated value, or None, we - // assume it's simplified. + // a non-null value that is different 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 different from the associated value, or None, we - // assume it's simplified. + // a non-null value that is different 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 4ce9611..cc667e5 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -9617,7 +9617,7 @@ private: 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 d4ff9f68..afa46f2 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 0316a14..3cab256 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 7c73079..4c635579 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -295,8 +295,8 @@ public: : 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 |