[llvm] 3eebbaf - [llvm] Use std::optional instead of None in comments (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 10 17:09:06 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T17:09:01-08:00
New Revision: 3eebbaf0e2de3f9a5af2f86a1c9264132c059215
URL: https://github.com/llvm/llvm-project/commit/3eebbaf0e2de3f9a5af2f86a1c9264132c059215
DIFF: https://github.com/llvm/llvm-project/commit/3eebbaf0e2de3f9a5af2f86a1c9264132c059215.diff
LOG: [llvm] Use std::optional 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/IRSimilarityIdentifier.h
llvm/include/llvm/CodeGen/MachineOperand.h
llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
llvm/lib/ObjCopy/MachO/MachOObject.h
llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index b663c18991e0d..56233674971a3 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -1085,7 +1085,7 @@ class IRSimilarityIdentifier {
bool EnableMustTailCalls = false;
/// The SimilarityGroups found with the most recent run of \ref
- /// findSimilarity. None if there is no recent run.
+ /// findSimilarity. std::nullopt if there is no recent run.
Optional<SimilarityGroupList> SimilarityCandidates;
};
diff --git a/llvm/include/llvm/CodeGen/MachineOperand.h b/llvm/include/llvm/CodeGen/MachineOperand.h
index c88e72cdc1d9c..67cc82098fa1e 100644
--- a/llvm/include/llvm/CodeGen/MachineOperand.h
+++ b/llvm/include/llvm/CodeGen/MachineOperand.h
@@ -281,8 +281,8 @@ class MachineOperand {
/// \param TypeToPrint specifies the generic type to be printed on uses and
/// defs. It can be determined using MachineInstr::getTypeToPrint.
/// \param OpIdx - specifies the index of the operand in machine instruction.
- /// This will be used by target dependent MIR formatter. Could be None if the
- /// index is unknown, e.g. called by dump().
+ /// This will be used by target dependent MIR formatter. Could be std::nullopt
+ /// if the index is unknown, e.g. called by dump().
/// \param PrintDef - whether we want to print `def` on an operand which
/// isDef. Sometimes, if the operand is printed before '=', we don't print
/// `def`.
diff --git a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
index bf2950b8aca0a..865d81f700739 100644
--- a/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
+++ b/llvm/include/llvm/MC/MCDisassembler/MCDisassembler.h
@@ -151,8 +151,9 @@ class MCDisassembler {
/// must hold the number of bytes that were decoded before
/// failing. The target must print nothing. This can be
/// done by buffering the output if needed.
- /// - None if the target doesn't want to handle the symbol
- /// separately. Value of Size is ignored in this case.
+ /// - std::nullopt if the target doesn't want to handle the
+ /// symbol separately. Value of Size is ignored in this
+ /// case.
virtual std::optional<DecodeStatus>
onSymbolStart(SymbolInfoTy &Symbol, uint64_t &Size, ArrayRef<uint8_t> Bytes,
uint64_t Address, raw_ostream &CStream) const;
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 6aad2581e06ac..ec80aa58bb044 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -484,7 +484,7 @@ struct BasicAAResult::DecomposedGEP {
// Scaled variable (non-constant) indices.
SmallVector<VariableGEPIndex, 4> VarIndices;
// Are all operations inbounds GEPs or non-indexing operations?
- // (None iff expression doesn't involve any geps)
+ // (std::nullopt iff expression doesn't involve any geps)
std::optional<bool> InBounds;
void dump() const {
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index fd573e6e9e459..9af263081d5e3 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -226,7 +226,7 @@ walkToAllocaAndPrependOffsetDeref(const DataLayout &DL, Value *Start,
return {End, Expression};
}
-/// Extract the offset used in \p DIExpr. Returns None if the expression
+/// Extract the offset used in \p DIExpr. Returns std::nullopt if the expression
/// doesn't explicitly describe a memory location with DW_OP_deref or if the
/// expression is too complex to interpret.
static Optional<int64_t> getDerefOffsetInBytes(const DIExpression *DIExpr) {
diff --git a/llvm/lib/ObjCopy/MachO/MachOObject.h b/llvm/lib/ObjCopy/MachO/MachOObject.h
index 6032b70627b90..b2c55f3ecb957 100644
--- a/llvm/lib/ObjCopy/MachO/MachOObject.h
+++ b/llvm/lib/ObjCopy/MachO/MachOObject.h
@@ -151,7 +151,7 @@ struct IndirectSymbolEntry {
// The original value in an indirect symbol table. Higher bits encode extra
// information (INDIRECT_SYMBOL_LOCAL and INDIRECT_SYMBOL_ABS).
uint32_t OriginalIndex;
- /// The Symbol referenced by this entry. It's None if the index is
+ /// The Symbol referenced by this entry. It's std::nullopt if the index is
/// INDIRECT_SYMBOL_LOCAL or INDIRECT_SYMBOL_ABS.
std::optional<SymbolEntry *> Symbol;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
index b6d37cf2918dc..91ca7cd2f7879 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
+++ b/llvm/lib/Target/AMDGPU/AMDGPUMachineModuleInfo.h
@@ -120,8 +120,8 @@ class AMDGPUMachineModuleInfo final : public MachineModuleInfoELF {
///
/// \returns True if synchronization scope \p A is larger than or equal to
/// synchronization scope \p B, false if synchronization scope \p A is smaller
- /// than synchronization scope \p B, or "None" if either synchronization scope
- /// \p A or \p B is not supported by the AMDGPU target.
+ /// than synchronization scope \p B, or "std::nullopt" if either
+ /// synchronization scope \p A or \p B is not supported by the AMDGPU target.
Optional<bool> isSyncScopeInclusion(SyncScope::ID A, SyncScope::ID B) const {
const auto &AIO = getSyncScopeInclusionOrdering(A);
const auto &BIO = getSyncScopeInclusionOrdering(B);
diff --git a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
index ea4b7165317ee..973e3b4d708c8 100644
--- a/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp
@@ -541,10 +541,10 @@ class LoopConstrainer {
// Calculated subranges we restrict the iteration space of the main loop to.
// See the implementation of `calculateSubRanges' for more details on how
- // these fields are computed. `LowLimit` is None if there is no restriction
- // on low end of the restricted iteration space of the main loop. `HighLimit`
- // is None if there is no restriction on high end of the restricted iteration
- // space of the main loop.
+ // these fields are computed. `LowLimit` is std::nullopt if there is no
+ // restriction on low end of the restricted iteration space of the main loop.
+ // `HighLimit` is std::nullopt if there is no restriction on high end of the
+ // restricted iteration space of the main loop.
struct SubRanges {
std::optional<const SCEV *> LowLimit;
More information about the llvm-commits
mailing list