[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
This commit is contained in:
parent
4b7428e151
commit
3c09ed006a
|
@ -2234,7 +2234,7 @@ APInt RoundingSDiv(const APInt &A, const APInt &B, APInt::Rounding RM);
|
|||
/// value to go from [-2^BW, 0) to [0, 2^BW). In that sense, zero is
|
||||
/// treated as a special case of an overflow.
|
||||
///
|
||||
/// This function returns None if after finding k that minimizes the
|
||||
/// This function returns std::nullopt if after finding k that minimizes the
|
||||
/// positive solution to q(n) = kR, both solutions are contained between
|
||||
/// two consecutive integers.
|
||||
///
|
||||
|
|
|
@ -293,7 +293,7 @@ public:
|
|||
return has_value() ? value() : std::forward<U>(alt);
|
||||
}
|
||||
|
||||
/// Apply a function to the value if present; otherwise return None.
|
||||
/// Apply a function to the value if present; otherwise return std::nullopt.
|
||||
template <class Function>
|
||||
auto transform(const Function &F) const & -> Optional<decltype(F(value()))> {
|
||||
if (*this)
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
return has_value() ? std::move(value()) : std::forward<U>(alt);
|
||||
}
|
||||
|
||||
/// Apply a function to the value if present; otherwise return None.
|
||||
/// Apply a function to the value if present; otherwise return std::nullopt.
|
||||
template <class Function>
|
||||
auto transform(
|
||||
const Function &F) && -> Optional<decltype(F(std::move(*this).value()))> {
|
||||
|
|
|
@ -888,7 +888,7 @@ public:
|
|||
/// Finds the positive number associated with \p V if it has been mapped.
|
||||
/// \param [in] V - the Value to find.
|
||||
/// \returns The positive number corresponding to the value.
|
||||
/// \returns None if not present.
|
||||
/// \returns std::nullopt if not present.
|
||||
Optional<unsigned> getGVN(Value *V) {
|
||||
assert(V != nullptr && "Value is a nullptr?");
|
||||
DenseMap<Value *, unsigned>::iterator VNIt = ValueToNumber.find(V);
|
||||
|
@ -900,7 +900,7 @@ public:
|
|||
/// Finds the Value associate with \p Num if it exists.
|
||||
/// \param [in] Num - the number to find.
|
||||
/// \returns The Value associated with the number.
|
||||
/// \returns None if not present.
|
||||
/// \returns std::nullopt if not present.
|
||||
Optional<Value *> fromGVN(unsigned Num) {
|
||||
DenseMap<unsigned, Value *>::iterator VNIt = NumberToValue.find(Num);
|
||||
if (VNIt == NumberToValue.end())
|
||||
|
|
|
@ -300,8 +300,8 @@ getInlineCost(CallBase &Call, Function *Callee, const InlineParams &Params,
|
|||
/// because of user directives, and the inlining is viable. Returns
|
||||
/// InlineResult::failure() if the inlining may never happen because of user
|
||||
/// directives or incompatibilities detectable without needing callee traversal.
|
||||
/// Otherwise returns None, meaning that inlining should be decided based on
|
||||
/// other criteria (e.g. cost modeling).
|
||||
/// Otherwise returns std::nullopt, meaning that inlining should be decided
|
||||
/// based on other criteria (e.g. cost modeling).
|
||||
Optional<InlineResult> getAttributeBasedInliningDecision(
|
||||
CallBase &Call, Function *Callee, TargetTransformInfo &CalleeTTI,
|
||||
function_ref<const TargetLibraryInfo &(Function &)> GetTLI);
|
||||
|
|
|
@ -721,7 +721,7 @@ const SCEV *replaceSymbolicStrideSCEV(PredicatedScalarEvolution &PSE,
|
|||
Value *Ptr);
|
||||
|
||||
/// If the pointer has a constant stride return it in units of the access type
|
||||
/// size. Otherwise return None.
|
||||
/// size. Otherwise return std::nullopt.
|
||||
///
|
||||
/// Ensure that it does not wrap in the address space, assuming the predicate
|
||||
/// associated with \p PSE is true.
|
||||
|
|
|
@ -54,9 +54,9 @@ inline bool isRetainOrClaimRV(ARCInstKind Kind) {
|
|||
}
|
||||
|
||||
/// This function returns the ARCInstKind of the function attached to operand
|
||||
/// bundle clang_arc_attachedcall. It returns None if the call doesn't have the
|
||||
/// operand bundle or the operand is null. Otherwise it returns either RetainRV
|
||||
/// or UnsafeClaimRV.
|
||||
/// bundle clang_arc_attachedcall. It returns std::nullopt if the call doesn't
|
||||
/// have the operand bundle or the operand is null. Otherwise it returns either
|
||||
/// RetainRV or UnsafeClaimRV.
|
||||
inline ARCInstKind getAttachedARCFunctionKind(const CallBase *CB) {
|
||||
Optional<Function *> Fn = getAttachedARCFunction(CB);
|
||||
if (!Fn)
|
||||
|
|
|
@ -1046,7 +1046,7 @@ public:
|
|||
|
||||
/// Check whether the condition described by Pred, LHS, and RHS is true or
|
||||
/// false. If we know it, return the evaluation of this condition. If neither
|
||||
/// is proved, return None.
|
||||
/// is proved, return std::nullopt.
|
||||
Optional<bool> evaluatePredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
|
||||
const SCEV *RHS);
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ public:
|
|||
|
||||
/// Check whether the condition described by Pred, LHS, and RHS is true or
|
||||
/// false in the given \p Context. If we know it, return the evaluation of
|
||||
/// this condition. If neither is proved, return None.
|
||||
/// this condition. If neither is proved, return std::nullopt.
|
||||
Optional<bool> evaluatePredicateAt(ICmpInst::Predicate Pred, const SCEV *LHS,
|
||||
const SCEV *RHS, const Instruction *CtxI);
|
||||
|
||||
|
@ -1079,7 +1079,8 @@ public:
|
|||
/// If, for all loop invariant X, the predicate "LHS `Pred` X" is
|
||||
/// monotonically increasing or decreasing, returns
|
||||
/// Some(MonotonicallyIncreasing) and Some(MonotonicallyDecreasing)
|
||||
/// respectively. If we could not prove either of these facts, returns None.
|
||||
/// respectively. If we could not prove either of these facts, returns
|
||||
/// std::nullopt.
|
||||
Optional<MonotonicPredicateType>
|
||||
getMonotonicPredicateType(const SCEVAddRecExpr *LHS,
|
||||
ICmpInst::Predicate Pred);
|
||||
|
@ -1095,7 +1096,7 @@ public:
|
|||
};
|
||||
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
|
||||
/// respect to L, return a LoopInvariantPredicate with LHS and RHS being
|
||||
/// invariants, available at L's entry. Otherwise, return None.
|
||||
/// invariants, available at L's entry. Otherwise, return std::nullopt.
|
||||
Optional<LoopInvariantPredicate>
|
||||
getLoopInvariantPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
|
||||
const SCEV *RHS, const Loop *L,
|
||||
|
@ -1104,8 +1105,8 @@ public:
|
|||
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
|
||||
/// respect to L at given Context during at least first MaxIter iterations,
|
||||
/// return a LoopInvariantPredicate with LHS and RHS being invariants,
|
||||
/// available at L's entry. Otherwise, return None. The predicate should be
|
||||
/// the loop's exit condition.
|
||||
/// available at L's entry. Otherwise, return std::nullopt. The predicate
|
||||
/// should be the loop's exit condition.
|
||||
Optional<LoopInvariantPredicate>
|
||||
getLoopInvariantExitCondDuringFirstIterations(ICmpInst::Predicate Pred,
|
||||
const SCEV *LHS,
|
||||
|
|
|
@ -813,10 +813,10 @@ bool matchSimpleRecurrence(const BinaryOperator *I, PHINode *&P, Value *&Start,
|
|||
Value *&Step);
|
||||
|
||||
/// Return true if RHS is known to be implied true by LHS. Return false if
|
||||
/// RHS is known to be implied false by LHS. Otherwise, return None if no
|
||||
/// implication can be made.
|
||||
/// A & B must be i1 (boolean) values or a vector of such values. Note that
|
||||
/// the truth table for implication is the same as <=u on i1 values (but not
|
||||
/// RHS is known to be implied false by LHS. Otherwise, return std::nullopt if
|
||||
/// no implication can be made. A & B must be i1 (boolean) values or a vector of
|
||||
/// such values. Note that the truth table for implication is the same as <=u on
|
||||
/// i1 values (but not
|
||||
/// <=s!). The truth table for both is:
|
||||
/// | T | F (B)
|
||||
/// T | T | F
|
||||
|
|
|
@ -560,7 +560,7 @@ public:
|
|||
Error ReadAbbrevRecord();
|
||||
|
||||
/// Read and return a block info block from the bitstream. If an error was
|
||||
/// encountered, return None.
|
||||
/// encountered, return std::nullopt.
|
||||
///
|
||||
/// \param ReadBlockInfoNames Whether to read block/record name information in
|
||||
/// the BlockInfo block. Only llvm-bcanalyzer uses this.
|
||||
|
|
|
@ -369,7 +369,7 @@ public:
|
|||
};
|
||||
|
||||
/// \returns The splat index of a G_SHUFFLE_VECTOR \p MI when \p MI is a splat.
|
||||
/// If \p MI is not a splat, returns None.
|
||||
/// If \p MI is not a splat, returns std::nullopt.
|
||||
Optional<int> getSplatIndex(MachineInstr &MI);
|
||||
|
||||
/// \returns the scalar integral splat value of \p Reg if possible.
|
||||
|
|
|
@ -231,7 +231,7 @@ public:
|
|||
StringRef getSectionContent(unsigned SectionID) const;
|
||||
|
||||
/// If the section was loaded, return the section's load address,
|
||||
/// otherwise return None.
|
||||
/// otherwise return std::nullopt.
|
||||
uint64_t getSectionLoadAddress(unsigned SectionID) const;
|
||||
|
||||
/// Set the NotifyStubEmitted callback. This is used for debugging
|
||||
|
|
|
@ -333,11 +333,11 @@ public:
|
|||
PreferredRangeType Type = Smallest) const;
|
||||
|
||||
/// Intersect the two ranges and return the result if it can be represented
|
||||
/// exactly, otherwise return None.
|
||||
/// exactly, otherwise return std::nullopt.
|
||||
Optional<ConstantRange> exactIntersectWith(const ConstantRange &CR) const;
|
||||
|
||||
/// Union the two ranges and return the result if it can be represented
|
||||
/// exactly, otherwise return None.
|
||||
/// exactly, otherwise return std::nullopt.
|
||||
Optional<ConstantRange> exactUnionWith(const ConstantRange &CR) const;
|
||||
|
||||
/// Return a new range representing the possible values resulting
|
||||
|
|
|
@ -1728,7 +1728,7 @@ public:
|
|||
/// Returns a new DILocation with updated base discriminator \p BD. Only the
|
||||
/// base discriminator is set in the new DILocation, the other encoded values
|
||||
/// are elided.
|
||||
/// If the discriminator cannot be encoded, the function returns None.
|
||||
/// If the discriminator cannot be encoded, the function returns std::nullopt.
|
||||
inline std::optional<const DILocation *>
|
||||
cloneWithBaseDiscriminator(unsigned BD) const;
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ public:
|
|||
bool isAbsoluteSymbolRef() const;
|
||||
|
||||
/// If this is an absolute symbol reference, returns the range of the symbol,
|
||||
/// otherwise returns None.
|
||||
/// otherwise returns std::nullopt.
|
||||
Optional<ConstantRange> getAbsoluteSymbolRange() const;
|
||||
|
||||
/// This method unlinks 'this' from the containing module, but does not delete
|
||||
|
|
|
@ -141,8 +141,8 @@ public:
|
|||
/// start of a symbol, or the entire symbol.
|
||||
/// This is used for example by WebAssembly to decode preludes.
|
||||
///
|
||||
/// Base implementation returns None. So all targets by default ignore to
|
||||
/// treat symbols separately.
|
||||
/// Base implementation returns std::nullopt. So all targets by default ignore
|
||||
/// to treat symbols separately.
|
||||
///
|
||||
/// \param Symbol - The symbol.
|
||||
/// \param Size - The number of bytes consumed.
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
// Look up a property, returning nullptr if it doesn't exist.
|
||||
Value *get(StringRef K);
|
||||
const Value *get(StringRef K) const;
|
||||
// Typed accessors return None/nullptr if
|
||||
// Typed accessors return std::nullopt/nullptr if
|
||||
// - the property doesn't exist
|
||||
// - or it has the wrong type
|
||||
llvm::Optional<std::nullptr_t> getNull(StringRef K) const;
|
||||
|
@ -400,7 +400,8 @@ public:
|
|||
llvm_unreachable("Unknown kind");
|
||||
}
|
||||
|
||||
// Typed accessors return None/nullptr if the Value is not of this type.
|
||||
// Typed accessors return std::nullopt/nullptr if the Value is not of this
|
||||
// type.
|
||||
llvm::Optional<std::nullptr_t> getAsNull() const {
|
||||
if (LLVM_LIKELY(Type == T_Null))
|
||||
return nullptr;
|
||||
|
|
|
@ -1744,7 +1744,7 @@ struct Attributor {
|
|||
}
|
||||
|
||||
/// If \p IRP is assumed to be a constant, return it, if it is unclear yet,
|
||||
/// return None, otherwise return `nullptr`.
|
||||
/// return std::nullopt, otherwise return `nullptr`.
|
||||
Optional<Constant *> getAssumedConstant(const IRPosition &IRP,
|
||||
const AbstractAttribute &AA,
|
||||
bool &UsedAssumedInformation);
|
||||
|
@ -1755,7 +1755,7 @@ struct Attributor {
|
|||
}
|
||||
|
||||
/// If \p V is assumed simplified, return it, if it is unclear yet,
|
||||
/// return None, otherwise return `nullptr`.
|
||||
/// return std::nullopt, otherwise return `nullptr`.
|
||||
Optional<Value *> getAssumedSimplified(const IRPosition &IRP,
|
||||
const AbstractAttribute &AA,
|
||||
bool &UsedAssumedInformation,
|
||||
|
@ -1771,8 +1771,9 @@ struct Attributor {
|
|||
}
|
||||
|
||||
/// If \p V is assumed simplified, return it, if it is unclear yet,
|
||||
/// return None, otherwise return `nullptr`. Same as the public version
|
||||
/// except that it can be used without recording dependences on any \p AA.
|
||||
/// return std::nullopt, otherwise return `nullptr`. Same as the public
|
||||
/// version except that it can be used without recording dependences on any \p
|
||||
/// AA.
|
||||
Optional<Value *> getAssumedSimplified(const IRPosition &V,
|
||||
const AbstractAttribute *AA,
|
||||
bool &UsedAssumedInformation,
|
||||
|
|
|
@ -621,8 +621,9 @@ template <class AliasAnalysisType> class ClobberWalker {
|
|||
/// value is the indices of searches that stopped at the last phi optimization
|
||||
/// target. It's left in an unspecified state.
|
||||
///
|
||||
/// If this returns None, NewPaused is a vector of searches that terminated
|
||||
/// at StopWhere. Otherwise, NewPaused is left in an unspecified state.
|
||||
/// If this returns std::nullopt, NewPaused is a vector of searches that
|
||||
/// terminated at StopWhere. Otherwise, NewPaused is left in an unspecified
|
||||
/// state.
|
||||
Optional<TerminatedPath>
|
||||
getBlockingAccess(const MemoryAccess *StopWhere,
|
||||
SmallVectorImpl<ListIndex> &PausedSearches,
|
||||
|
|
|
@ -83,7 +83,7 @@ Optional<uint64_t> ProfileSummaryInfo::getProfileCount(
|
|||
// In sample PGO mode, check if there is a profile metadata on the
|
||||
// instruction. If it is present, determine hotness solely based on that,
|
||||
// since the sampled entry count may not be accurate. If there is no
|
||||
// annotated on the instruction, return None.
|
||||
// annotated on the instruction, return std::nullopt.
|
||||
uint64_t TotalCount;
|
||||
if (Call.extractProfTotalWeight(TotalCount))
|
||||
return TotalCount;
|
||||
|
|
|
@ -712,8 +712,8 @@ CompareValueComplexity(EquivalenceClasses<const Value *> &EqCacheValue,
|
|||
// Return negative, zero, or positive, if LHS is less than, equal to, or greater
|
||||
// than RHS, respectively. A three-way result allows recursive comparisons to be
|
||||
// more efficient.
|
||||
// If the max analysis depth was reached, return None, assuming we do not know
|
||||
// if they are equivalent for sure.
|
||||
// If the max analysis depth was reached, return std::nullopt, assuming we do
|
||||
// not know if they are equivalent for sure.
|
||||
static std::optional<int>
|
||||
CompareSCEVComplexity(EquivalenceClasses<const SCEV *> &EqCacheSCEV,
|
||||
EquivalenceClasses<const Value *> &EqCacheValue,
|
||||
|
@ -10005,8 +10005,8 @@ static const SCEV *SolveLinEquationWithOverflow(const APInt &A, const SCEV *B,
|
|||
/// Ax^2 + Bx + C is the quadratic function, M is the value that A, B and C
|
||||
/// were multiplied by, and BitWidth is the bit width of the original addrec
|
||||
/// coefficients.
|
||||
/// This function returns None if the addrec coefficients are not compile-
|
||||
/// time constants.
|
||||
/// This function returns std::nullopt if the addrec coefficients are not
|
||||
/// compile- time constants.
|
||||
static std::optional<std::tuple<APInt, APInt, APInt, APInt, unsigned>>
|
||||
GetQuadraticEquation(const SCEVAddRecExpr *AddRec) {
|
||||
assert(AddRec->getNumOperands() == 3 && "This is not a quadratic chrec!");
|
||||
|
@ -10059,7 +10059,7 @@ GetQuadraticEquation(const SCEVAddRecExpr *AddRec) {
|
|||
|
||||
/// Helper function to compare optional APInts:
|
||||
/// (a) if X and Y both exist, return min(X, Y),
|
||||
/// (b) if neither X nor Y exist, return None,
|
||||
/// (b) if neither X nor Y exist, return std::nullopt,
|
||||
/// (c) if exactly one of X and Y exists, return that value.
|
||||
static Optional<APInt> MinOptional(Optional<APInt> X, Optional<APInt> Y) {
|
||||
if (X && Y) {
|
||||
|
@ -10102,7 +10102,7 @@ static Optional<APInt> TruncIfPossible(Optional<APInt> X, unsigned BitWidth) {
|
|||
/// returned as such, otherwise the bit width of the returned value may
|
||||
/// be greater than BW.
|
||||
///
|
||||
/// This function returns None if
|
||||
/// This function returns std::nullopt if
|
||||
/// (a) the addrec coefficients are not constant, or
|
||||
/// (b) SolveQuadraticEquationWrap was unable to find a solution. For cases
|
||||
/// like x^2 = 5, no integer solutions exist, in other cases an integer
|
||||
|
@ -10135,7 +10135,7 @@ SolveQuadraticAddRecExact(const SCEVAddRecExpr *AddRec, ScalarEvolution &SE) {
|
|||
/// Find the least n such that c(n) does not belong to the given range,
|
||||
/// while c(n-1) does.
|
||||
///
|
||||
/// This function returns None if
|
||||
/// This function returns std::nullopt if
|
||||
/// (a) the addrec coefficients are not constant, or
|
||||
/// (b) SolveQuadraticEquationWrap was unable to find a solution for the
|
||||
/// bounds of the range.
|
||||
|
@ -10196,8 +10196,8 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec,
|
|||
return false;
|
||||
};
|
||||
|
||||
// If SolveQuadraticEquationWrap returns None, it means that there can
|
||||
// be a solution, but the function failed to find it. We cannot treat it
|
||||
// If SolveQuadraticEquationWrap returns std::nullopt, it means that there
|
||||
// can be a solution, but the function failed to find it. We cannot treat it
|
||||
// as "no solution".
|
||||
if (!SO || !UO)
|
||||
return {std::nullopt, false};
|
||||
|
@ -10249,7 +10249,7 @@ SolveQuadraticAddRecRange(const SCEVAddRecExpr *AddRec,
|
|||
// the range before or that we started outside of it. Both of these cases
|
||||
// are contradictions.
|
||||
//
|
||||
// Claim: In the case where SolveForBoundary returns None, the correct
|
||||
// Claim: In the case where SolveForBoundary returns std::nullopt, the correct
|
||||
// solution is not some value between the Max for this boundary and the
|
||||
// Min of the other boundary.
|
||||
//
|
||||
|
|
|
@ -95,7 +95,7 @@ ParseRet tryParseVLEN(StringRef &ParseString, unsigned &VF, bool &IsScalable) {
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `Pos` to
|
||||
/// <number>, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
///
|
||||
/// The function expects <token> to be one of "ls", "Rs", "Us" or
|
||||
/// "Ls".
|
||||
|
@ -122,7 +122,7 @@ ParseRet tryParseLinearTokenWithRuntimeStep(StringRef &ParseString,
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `StepOrPos` to
|
||||
/// <number>, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
ParseRet tryParseLinearWithRuntimeStep(StringRef &ParseString,
|
||||
VFParamKind &PKind, int &StepOrPos) {
|
||||
ParseRet Ret;
|
||||
|
@ -158,7 +158,7 @@ ParseRet tryParseLinearWithRuntimeStep(StringRef &ParseString,
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `LinearStep` to
|
||||
/// <number>, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
///
|
||||
/// The function expects <token> to be one of "l", "R", "U" or
|
||||
/// "L".
|
||||
|
@ -186,7 +186,7 @@ ParseRet tryParseCompileTimeLinearToken(StringRef &ParseString,
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `LinearStep` to
|
||||
/// <number>, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
ParseRet tryParseLinearWithCompileTimeStep(StringRef &ParseString,
|
||||
VFParamKind &PKind, int &StepOrPos) {
|
||||
// "l" {"n"} <CompileTimeStep>
|
||||
|
@ -219,7 +219,7 @@ ParseRet tryParseLinearWithCompileTimeStep(StringRef &ParseString,
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `StepOrPos`
|
||||
/// accordingly, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
ParseRet tryParseParameter(StringRef &ParseString, VFParamKind &PKind,
|
||||
int &StepOrPos) {
|
||||
if (ParseString.consume_front("v")) {
|
||||
|
@ -254,7 +254,7 @@ ParseRet tryParseParameter(StringRef &ParseString, VFParamKind &PKind,
|
|||
/// On success, it removes the parsed parameter from `ParseString`,
|
||||
/// sets `PKind` to the correspondent enum value, sets `StepOrPos`
|
||||
/// accordingly, and return success. On a syntax error, it return a
|
||||
/// parsing error. If nothing is parsed, it returns None.
|
||||
/// parsing error. If nothing is parsed, it returns std::nullopt.
|
||||
ParseRet tryParseAlign(StringRef &ParseString, Align &Alignment) {
|
||||
uint64_t Val;
|
||||
// "a" <number>
|
||||
|
|
|
@ -2742,7 +2742,7 @@ bool isKnownNonZero(const Value* V, unsigned Depth, const Query& Q) {
|
|||
|
||||
/// If the pair of operators are the same invertible function, return the
|
||||
/// the operands of the function corresponding to each input. Otherwise,
|
||||
/// return None. An invertible function is one that is 1-to-1 and maps
|
||||
/// return std::nullopt. An invertible function is one that is 1-to-1 and maps
|
||||
/// every input value to exactly one output value. This is equivalent to
|
||||
/// saying that Op1 and Op2 are equal exactly when the specified pair of
|
||||
/// operands are equal, (except that Op1 and Op2 may be poison more often.)
|
||||
|
@ -6657,7 +6657,7 @@ static bool isTruePredicate(CmpInst::Predicate Pred, const Value *LHS,
|
|||
}
|
||||
|
||||
/// Return true if "icmp Pred BLHS BRHS" is true whenever "icmp Pred
|
||||
/// ALHS ARHS" is true. Otherwise, return None.
|
||||
/// ALHS ARHS" is true. Otherwise, return std::nullopt.
|
||||
static Optional<bool>
|
||||
isImpliedCondOperands(CmpInst::Predicate Pred, const Value *ALHS,
|
||||
const Value *ARHS, const Value *BLHS, const Value *BRHS,
|
||||
|
@ -6694,7 +6694,7 @@ static bool areMatchingOperands(const Value *L0, const Value *L1, const Value *R
|
|||
|
||||
/// Return true if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is true.
|
||||
/// Return false if "icmp1 LPred X, Y" implies "icmp2 RPred X, Y" is false.
|
||||
/// Otherwise, return None if we can't infer anything.
|
||||
/// Otherwise, return std::nullopt if we can't infer anything.
|
||||
static Optional<bool> isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
|
||||
CmpInst::Predicate RPred,
|
||||
bool AreSwappedOps) {
|
||||
|
@ -6712,7 +6712,7 @@ static Optional<bool> isImpliedCondMatchingOperands(CmpInst::Predicate LPred,
|
|||
|
||||
/// Return true if "icmp LPred X, LC" implies "icmp RPred X, RC" is true.
|
||||
/// Return false if "icmp LPred X, LC" implies "icmp RPred X, RC" is false.
|
||||
/// Otherwise, return None if we can't infer anything.
|
||||
/// Otherwise, return std::nullopt if we can't infer anything.
|
||||
static Optional<bool> isImpliedCondCommonOperandWithConstants(
|
||||
CmpInst::Predicate LPred, const APInt &LC, CmpInst::Predicate RPred,
|
||||
const APInt &RC) {
|
||||
|
@ -6728,8 +6728,8 @@ static Optional<bool> isImpliedCondCommonOperandWithConstants(
|
|||
}
|
||||
|
||||
/// Return true if LHS implies RHS (expanded to its components as "R0 RPred R1")
|
||||
/// is true. Return false if LHS implies RHS is false. Otherwise, return None
|
||||
/// if we can't infer anything.
|
||||
/// is true. Return false if LHS implies RHS is false. Otherwise, return
|
||||
/// std::nullopt if we can't infer anything.
|
||||
static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
|
||||
CmpInst::Predicate RPred,
|
||||
const Value *R0, const Value *R1,
|
||||
|
@ -6761,8 +6761,9 @@ static Optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
|
|||
}
|
||||
|
||||
/// Return true if LHS implies RHS is true. Return false if LHS implies RHS is
|
||||
/// false. Otherwise, return None if we can't infer anything. We expect the
|
||||
/// RHS to be an icmp and the LHS to be an 'and', 'or', or a 'select' instruction.
|
||||
/// false. Otherwise, return std::nullopt if we can't infer anything. We
|
||||
/// expect the RHS to be an icmp and the LHS to be an 'and', 'or', or a 'select'
|
||||
/// instruction.
|
||||
static Optional<bool>
|
||||
isImpliedCondAndOr(const Instruction *LHS, CmpInst::Predicate RHSPred,
|
||||
const Value *RHSOp0, const Value *RHSOp1,
|
||||
|
|
|
@ -1433,7 +1433,7 @@ bool matchIncrement(const Instruction *IVInc, Instruction *&LHS,
|
|||
|
||||
/// If given \p PN is an inductive variable with value IVInc coming from the
|
||||
/// backedge, and on each iteration it gets increased by Step, return pair
|
||||
/// <IVInc, Step>. Otherwise, return None.
|
||||
/// <IVInc, Step>. Otherwise, return std::nullopt.
|
||||
static std::optional<std::pair<Instruction *, Constant *>>
|
||||
getIVIncrement(const PHINode *PN, const LoopInfo *LI) {
|
||||
const Loop *L = LI->getLoopFor(PN->getParent());
|
||||
|
|
|
@ -7892,8 +7892,8 @@ private:
|
|||
/// byte of the given value. Returns None if the provider can't be calculated.
|
||||
///
|
||||
/// For all the values except the root of the expression, we verify that the
|
||||
/// value has exactly one use and if not then return None. This way if the
|
||||
/// origin of the byte is returned it's guaranteed that the values which
|
||||
/// value has exactly one use and if not then return std::nullopt. This way if
|
||||
/// the origin of the byte is returned it's guaranteed that the values which
|
||||
/// contribute to the byte are not used outside of this expression.
|
||||
|
||||
/// However, there is a special case when dealing with vector loads -- we allow
|
||||
|
|
|
@ -492,7 +492,8 @@ void MarkupFilter::printValue(Twine Value) {
|
|||
}
|
||||
|
||||
// This macro helps reduce the amount of indirection done through Optional
|
||||
// below, since the usual case upon returning a None Optional is to return None.
|
||||
// below, since the usual case upon returning a std::nullopt Optional is to
|
||||
// return None.
|
||||
#define ASSIGN_OR_RETURN_NONE(TYPE, NAME, EXPR) \
|
||||
auto NAME##Opt = (EXPR); \
|
||||
if (!NAME##Opt) \
|
||||
|
|
|
@ -4970,7 +4970,7 @@ MachOObjectFile::getChainedFixupsLoadCommand() const {
|
|||
*DyldChainedFixupsOrErr;
|
||||
|
||||
// If the load command is present but the data offset has been zeroed out,
|
||||
// as is the case for dylib stubs, return None (no error).
|
||||
// as is the case for dylib stubs, return std::nullopt (no error).
|
||||
if (!DyldChainedFixups.dataoff)
|
||||
return std::nullopt;
|
||||
return DyldChainedFixups;
|
||||
|
|
|
@ -1643,7 +1643,7 @@ static UsedNZCV getUsedNZCV(AArch64CC::CondCode CC) {
|
|||
|
||||
/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
|
||||
/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
|
||||
/// \returns None otherwise.
|
||||
/// \returns std::nullopt otherwise.
|
||||
///
|
||||
/// Collect instructions using that flags in \p CCUseInstrs if provided.
|
||||
std::optional<UsedNZCV>
|
||||
|
|
|
@ -389,7 +389,7 @@ struct UsedNZCV {
|
|||
|
||||
/// \returns Conditions flags used after \p CmpInstr in its MachineBB if NZCV
|
||||
/// flags are not alive in successors of the same \p CmpInstr and \p MI parent.
|
||||
/// \returns None otherwise.
|
||||
/// \returns std::nullopt otherwise.
|
||||
///
|
||||
/// Collect instructions using that flags in \p CCUseInstrs if provided.
|
||||
std::optional<UsedNZCV>
|
||||
|
|
|
@ -5992,7 +5992,7 @@ AArch64InstructionSelector::selectShiftB_64(const MachineOperand &Root) const {
|
|||
|
||||
/// Helper to select an immediate value that can be represented as a 12-bit
|
||||
/// value shifted left by either 0 or 12. If it is possible to do so, return
|
||||
/// the immediate and shift value. If not, return None.
|
||||
/// the immediate and shift value. If not, return std::nullopt.
|
||||
///
|
||||
/// Used by selectArithImmed and selectNegArithImmed.
|
||||
InstructionSelector::ComplexRendererFns
|
||||
|
@ -6251,8 +6251,8 @@ AArch64InstructionSelector::selectAddrModeShiftedExtendXReg(
|
|||
///
|
||||
/// Where x2 is the base register, and x3 is an offset register.
|
||||
///
|
||||
/// When possible (or profitable) to fold a G_PTR_ADD into the address calculation,
|
||||
/// this will do so. Otherwise, it will return None.
|
||||
/// When possible (or profitable) to fold a G_PTR_ADD into the address
|
||||
/// calculation, this will do so. Otherwise, it will return std::nullopt.
|
||||
InstructionSelector::ComplexRendererFns
|
||||
AArch64InstructionSelector::selectAddrModeRegisterOffset(
|
||||
MachineOperand &Root) const {
|
||||
|
|
|
@ -89,9 +89,9 @@ void PPCELFStreamer::emitInstruction(const MCInst &Inst,
|
|||
static_cast<PPCMCCodeEmitter*>(getAssembler().getEmitterPtr());
|
||||
|
||||
// If the instruction is a part of the GOT to PC-Rel link time optimization
|
||||
// instruction pair, return a value, otherwise return None. A true returned
|
||||
// value means the instruction is the PLDpc and a false value means it is
|
||||
// the user instruction.
|
||||
// instruction pair, return a value, otherwise return std::nullopt. A true
|
||||
// returned value means the instruction is the PLDpc and a false value means
|
||||
// it is the user instruction.
|
||||
std::optional<bool> IsPartOfGOTToPCRelPair =
|
||||
isPartOfGOTToPCRelPair(Inst, STI);
|
||||
|
||||
|
@ -206,7 +206,8 @@ std::optional<bool> llvm::isPartOfGOTToPCRelPair(const MCInst &Inst,
|
|||
unsigned LastOp = Inst.getNumOperands() - 1;
|
||||
// The last operand needs to be an MCExpr and it needs to have a variant kind
|
||||
// of VK_PPC_PCREL_OPT. If it does not satisfy these conditions it is not a
|
||||
// link time GOT PC Rel opt instruction and we can ignore it and return None.
|
||||
// link time GOT PC Rel opt instruction and we can ignore it and return
|
||||
// std::nullopt.
|
||||
const MCOperand &Operand = Inst.getOperand(LastOp);
|
||||
if (!Operand.isExpr())
|
||||
return std::nullopt;
|
||||
|
|
|
@ -8786,8 +8786,8 @@ struct NodeExtensionHelper {
|
|||
/// anything. Instead they produce an optional CombineResult that if not None,
|
||||
/// need to be materialized for the combine to be applied.
|
||||
/// \see CombineResult::materialize.
|
||||
/// If the related CombineToTry function returns None, that means the combine
|
||||
/// didn't match.
|
||||
/// If the related CombineToTry function returns std::nullopt, that means the
|
||||
/// combine didn't match.
|
||||
static SmallVector<CombineToTry> getSupportedFoldings(const SDNode *Root);
|
||||
};
|
||||
|
||||
|
@ -8835,8 +8835,8 @@ struct CombineResult {
|
|||
/// \note If the pattern can match with both zext and sext, the returned
|
||||
/// CombineResult will feature the zext result.
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVWWithSameExtensionImpl(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS, bool AllowSExt,
|
||||
|
@ -8861,8 +8861,8 @@ canFoldToVWWithSameExtensionImpl(SDNode *Root, const NodeExtensionHelper &LHS,
|
|||
/// where `ext` is the same for both LHS and RHS (i.e., both are sext or both
|
||||
/// are zext) and LHS and RHS can be folded into Root.
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVWWithSameExtension(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS) {
|
||||
|
@ -8872,8 +8872,8 @@ canFoldToVWWithSameExtension(SDNode *Root, const NodeExtensionHelper &LHS,
|
|||
|
||||
/// Check if \p Root follows a pattern Root(LHS, ext(RHS))
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVW_W(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS) {
|
||||
|
@ -8897,8 +8897,8 @@ canFoldToVW_W(SDNode *Root, const NodeExtensionHelper &LHS,
|
|||
|
||||
/// Check if \p Root follows a pattern Root(sext(LHS), sext(RHS))
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVWWithSEXT(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS) {
|
||||
|
@ -8908,8 +8908,8 @@ canFoldToVWWithSEXT(SDNode *Root, const NodeExtensionHelper &LHS,
|
|||
|
||||
/// Check if \p Root follows a pattern Root(zext(LHS), zext(RHS))
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVWWithZEXT(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS) {
|
||||
|
@ -8919,8 +8919,8 @@ canFoldToVWWithZEXT(SDNode *Root, const NodeExtensionHelper &LHS,
|
|||
|
||||
/// Check if \p Root follows a pattern Root(sext(LHS), zext(RHS))
|
||||
///
|
||||
/// \returns None if the pattern doesn't match or a CombineResult that can be
|
||||
/// used to apply the pattern.
|
||||
/// \returns std::nullopt if the pattern doesn't match or a CombineResult that
|
||||
/// can be used to apply the pattern.
|
||||
static std::optional<CombineResult>
|
||||
canFoldToVW_SU(SDNode *Root, const NodeExtensionHelper &LHS,
|
||||
const NodeExtensionHelper &RHS) {
|
||||
|
|
|
@ -2845,7 +2845,7 @@ private:
|
|||
// - If the value is assumed, then stop.
|
||||
// - If the value is known but undef, then consider it UB.
|
||||
// - Otherwise, do specific processing with the simplified value.
|
||||
// We return None in the first 2 cases to signify that an appropriate
|
||||
// We return std::nullopt in the first 2 cases to signify that an appropriate
|
||||
// action was taken and the caller should stop.
|
||||
// Otherwise, we return the simplified value that the caller should
|
||||
// use for specific processing.
|
||||
|
|
|
@ -462,7 +462,7 @@ void OutlinableRegion::reattachCandidate() {
|
|||
/// \param GVNToConstant - The mapping of global value number to Constants.
|
||||
/// \returns true if the Value matches the Constant mapped to by V and false if
|
||||
/// it \p V is a Constant but does not match.
|
||||
/// \returns None if \p V is not a Constant.
|
||||
/// \returns std::nullopt if \p V is not a Constant.
|
||||
static Optional<bool>
|
||||
constantMatches(Value *V, unsigned GVN,
|
||||
DenseMap<unsigned, Constant *> &GVNToConstant) {
|
||||
|
|
|
@ -2484,7 +2484,7 @@ struct AAICVTrackerFunction : public AAICVTracker {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// We don't check unique value for a function, so return None.
|
||||
// We don't check unique value for a function, so return std::nullopt.
|
||||
Optional<Value *>
|
||||
getUniqueReplacementValue(InternalControlVar ICV) const override {
|
||||
return std::nullopt;
|
||||
|
|
|
@ -171,7 +171,7 @@ public:
|
|||
|
||||
/// If it is an interesting memory access, populate information
|
||||
/// about the access and return a InterestingMemoryAccess struct.
|
||||
/// Otherwise return None.
|
||||
/// Otherwise return std::nullopt.
|
||||
Optional<InterestingMemoryAccess>
|
||||
isInterestingMemoryAccess(Instruction *I) const;
|
||||
|
||||
|
|
|
@ -1293,7 +1293,7 @@ struct DSEState {
|
|||
// Find a MemoryDef writing to \p KillingLoc and dominating \p StartAccess,
|
||||
// with no read access between them or on any other path to a function exit
|
||||
// block if \p KillingLoc is not accessible after the function returns. If
|
||||
// there is no such MemoryDef, return None. The returned value may not
|
||||
// there is no such MemoryDef, return std::nullopt. The returned value may not
|
||||
// (completely) overwrite \p KillingLoc. Currently we bail out when we
|
||||
// encounter an aliasing MemoryUse (read).
|
||||
Optional<MemoryAccess *>
|
||||
|
|
|
@ -1581,7 +1581,7 @@ bool LoopConstrainer::run() {
|
|||
|
||||
/// Computes and returns a range of values for the induction variable (IndVar)
|
||||
/// in which the range check can be safely elided. If it cannot compute such a
|
||||
/// range, returns None.
|
||||
/// range, returns std::nullopt.
|
||||
Optional<InductiveRangeCheck::Range>
|
||||
InductiveRangeCheck::computeSafeIterationSpace(
|
||||
ScalarEvolution &SE, const SCEVAddRecExpr *IndVar,
|
||||
|
@ -1733,7 +1733,7 @@ IntersectSignedRange(ScalarEvolution &SE,
|
|||
const SCEV *NewBegin = SE.getSMaxExpr(R1Value.getBegin(), R2.getBegin());
|
||||
const SCEV *NewEnd = SE.getSMinExpr(R1Value.getEnd(), R2.getEnd());
|
||||
|
||||
// If the resulting range is empty, just return None.
|
||||
// If the resulting range is empty, just return std::nullopt.
|
||||
auto Ret = InductiveRangeCheck::Range(NewBegin, NewEnd);
|
||||
if (Ret.isEmpty(SE, /* IsSigned */ true))
|
||||
return std::nullopt;
|
||||
|
@ -1762,7 +1762,7 @@ IntersectUnsignedRange(ScalarEvolution &SE,
|
|||
const SCEV *NewBegin = SE.getUMaxExpr(R1Value.getBegin(), R2.getBegin());
|
||||
const SCEV *NewEnd = SE.getUMinExpr(R1Value.getEnd(), R2.getEnd());
|
||||
|
||||
// If the resulting range is empty, just return None.
|
||||
// If the resulting range is empty, just return std::nullopt.
|
||||
auto Ret = InductiveRangeCheck::Range(NewBegin, NewEnd);
|
||||
if (Ret.isEmpty(SE, /* IsSigned */ false))
|
||||
return std::nullopt;
|
||||
|
|
|
@ -684,10 +684,9 @@ static void normalizePredicate(ScalarEvolution *SE, Loop *L,
|
|||
ICmpInst::ICMP_ULT : ICmpInst::ICMP_UGE;
|
||||
}
|
||||
|
||||
|
||||
/// If ICI can be widened to a loop invariant condition emits the loop
|
||||
/// invariant condition in the loop preheader and return it, otherwise
|
||||
/// returns None.
|
||||
/// returns std::nullopt.
|
||||
Optional<Value *> LoopPredication::widenICmpRangeCheck(ICmpInst *ICI,
|
||||
SCEVExpander &Expander,
|
||||
Instruction *Guard) {
|
||||
|
|
|
@ -270,8 +270,8 @@ private:
|
|||
/// MDNode, compute and return the mapping. If it's a distinct \a MDNode,
|
||||
/// return the result of \a mapDistinctNode().
|
||||
///
|
||||
/// \return None if \c Op is an unmapped uniqued \a MDNode.
|
||||
/// \post getMappedOp(Op) only returns None if this returns None.
|
||||
/// \return std::nullopt if \c Op is an unmapped uniqued \a MDNode.
|
||||
/// \post getMappedOp(Op) only returns std::nullopt if this returns None.
|
||||
Optional<Metadata *> tryToMapOperand(const Metadata *Op);
|
||||
|
||||
/// Map a distinct node.
|
||||
|
@ -317,11 +317,10 @@ private:
|
|||
/// This visits all the nodes in \c G in post-order, using the identity
|
||||
/// mapping or creating a new node depending on \a Data::HasChanged.
|
||||
///
|
||||
/// \pre \a getMappedOp() returns None for nodes in \c G, but not for any of
|
||||
/// their operands outside of \c G.
|
||||
/// \pre \a Data::HasChanged is true for a node in \c G iff any of its
|
||||
/// operands have changed.
|
||||
/// \post \a getMappedOp() returns the mapped node for every node in \c G.
|
||||
/// \pre \a getMappedOp() returns std::nullopt for nodes in \c G, but not for
|
||||
/// any of their operands outside of \c G. \pre \a Data::HasChanged is true
|
||||
/// for a node in \c G iff any of its operands have changed. \post \a
|
||||
/// getMappedOp() returns the mapped node for every node in \c G.
|
||||
void mapNodesInPOT(UniquedGraph &G);
|
||||
|
||||
/// Remap a node's operands using the given functor.
|
||||
|
|
|
@ -1641,7 +1641,7 @@ public:
|
|||
|
||||
// Search all operands in Ops[*][Lane] for the one that matches best
|
||||
// Ops[OpIdx][LastLane] and return its opreand index.
|
||||
// If no good match can be found, return None.
|
||||
// If no good match can be found, return std::nullopt.
|
||||
Optional<unsigned> getBestOperand(unsigned OpIdx, int Lane, int LastLane,
|
||||
ArrayRef<ReorderingMode> ReorderingModes,
|
||||
ArrayRef<Value *> MainAltOps) {
|
||||
|
@ -1721,7 +1721,7 @@ public:
|
|||
getData(*BestOp.Idx, Lane).IsUsed = IsUsed;
|
||||
return BestOp.Idx;
|
||||
}
|
||||
// If we could not find a good match return None.
|
||||
// If we could not find a good match return std::nullopt.
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1681,8 +1681,8 @@ static void disassembleObject(const Target *TheTarget, ObjectFile &Obj,
|
|||
SectionAddr + Start, CommentStream);
|
||||
|
||||
if (!Status) {
|
||||
// If onSymbolStart returns None, that means it didn't trigger any
|
||||
// interesting handling for this symbol. Try the other symbols
|
||||
// If onSymbolStart returns std::nullopt, that means it didn't trigger
|
||||
// any interesting handling for this symbol. Try the other symbols
|
||||
// defined at this address.
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -1214,7 +1214,7 @@ TEST_F(DILocationTest, discriminatorSpecialCases) {
|
|||
.value()
|
||||
->getDuplicationFactor());
|
||||
|
||||
// Check we return None for unencodable cases.
|
||||
// Check we return std::nullopt for unencodable cases.
|
||||
EXPECT_EQ(std::nullopt, L4->cloneWithBaseDiscriminator(0x1000));
|
||||
EXPECT_EQ(std::nullopt, L4->cloneByMultiplyingDuplicationFactor(0x1000));
|
||||
}
|
||||
|
|
|
@ -344,7 +344,8 @@ TEST(DataExtractorTest, FixedLengthString) {
|
|||
DataExtractor DE(StringRef(Data, sizeof(Data)-1), false, 8);
|
||||
uint64_t Offset = 0;
|
||||
StringRef Str;
|
||||
// Test extracting too many bytes doesn't modify Offset and returns None.
|
||||
// Test extracting too many bytes doesn't modify Offset and returns
|
||||
// std::nullopt.
|
||||
Str = DE.getFixedLengthString(&Offset, sizeof(Data));
|
||||
EXPECT_TRUE(Str.empty());
|
||||
EXPECT_EQ(Offset, 0u);
|
||||
|
@ -374,7 +375,8 @@ TEST(DataExtractorTest, GetBytes) {
|
|||
DataExtractor DE(Bytes, false, 8);
|
||||
uint64_t Offset = 0;
|
||||
StringRef Str;
|
||||
// Test extracting too many bytes doesn't modify Offset and returns None.
|
||||
// Test extracting too many bytes doesn't modify Offset and returns
|
||||
// std::nullopt.
|
||||
Str = DE.getBytes(&Offset, sizeof(Data));
|
||||
EXPECT_TRUE(Str.empty());
|
||||
EXPECT_EQ(Offset, 0u);
|
||||
|
|
|
@ -3682,7 +3682,7 @@ private:
|
|||
/// Infer a CodeGenRegisterClass for the type of \p SuperRegNode. The returned
|
||||
/// CodeGenRegisterClass will support the CodeGenRegisterClass of
|
||||
/// \p SubRegNode, and the subregister index defined by \p SubRegIdxNode.
|
||||
/// If no register class is found, return None.
|
||||
/// If no register class is found, return std::nullopt.
|
||||
Optional<const CodeGenRegisterClass *>
|
||||
inferSuperRegisterClassForNode(const TypeSetByHwMode &Ty,
|
||||
TreePatternNode *SuperRegNode,
|
||||
|
|
Loading…
Reference in New Issue