aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-12-05 04:30:54 +0000
committerFangrui Song <i@maskray.me>2022-12-05 04:30:54 +0000
commit3dfacc0a56e9d5718f51b1d3ce63070e79fc2608 (patch)
treef64c312d1d482b70ffb29397f9cf66eebd9c5a12 /llvm/lib/FileCheck/FileCheck.cpp
parent4b1b9e22b3cb854e90e718e9d10d7ceb6e12f26a (diff)
downloadllvm-3dfacc0a56e9d5718f51b1d3ce63070e79fc2608.zip
llvm-3dfacc0a56e9d5718f51b1d3ce63070e79fc2608.tar.gz
llvm-3dfacc0a56e9d5718f51b1d3ce63070e79fc2608.tar.bz2
CheckedArithmetic: llvm::Optional => std::optional
Diffstat (limited to 'llvm/lib/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/lib/FileCheck/FileCheck.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index f428e3f..e2cc6dc 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -206,7 +206,7 @@ Expected<ExpressionValue> llvm::operator+(const ExpressionValue &LeftOperand,
if (LeftOperand.isNegative() && RightOperand.isNegative()) {
int64_t LeftValue = cantFail(LeftOperand.getSignedValue());
int64_t RightValue = cantFail(RightOperand.getSignedValue());
- Optional<int64_t> Result = checkedAdd<int64_t>(LeftValue, RightValue);
+ std::optional<int64_t> Result = checkedAdd<int64_t>(LeftValue, RightValue);
if (!Result)
return make_error<OverflowError>();
@@ -224,7 +224,7 @@ Expected<ExpressionValue> llvm::operator+(const ExpressionValue &LeftOperand,
// Both values are positive at this point.
uint64_t LeftValue = cantFail(LeftOperand.getUnsignedValue());
uint64_t RightValue = cantFail(RightOperand.getUnsignedValue());
- Optional<uint64_t> Result =
+ std::optional<uint64_t> Result =
checkedAddUnsigned<uint64_t>(LeftValue, RightValue);
if (!Result)
return make_error<OverflowError>();
@@ -241,7 +241,7 @@ Expected<ExpressionValue> llvm::operator-(const ExpressionValue &LeftOperand,
// Result <= -1 - (max int64_t) which overflows on 1- and 2-complement.
if (RightValue > (uint64_t)std::numeric_limits<int64_t>::max())
return make_error<OverflowError>();
- Optional<int64_t> Result =
+ std::optional<int64_t> Result =
checkedSub(LeftValue, static_cast<int64_t>(RightValue));
if (!Result)
return make_error<OverflowError>();
@@ -306,7 +306,7 @@ Expected<ExpressionValue> llvm::operator*(const ExpressionValue &LeftOperand,
// Result will be positive and can overflow.
uint64_t LeftValue = cantFail(LeftOperand.getUnsignedValue());
uint64_t RightValue = cantFail(RightOperand.getUnsignedValue());
- Optional<uint64_t> Result =
+ std::optional<uint64_t> Result =
checkedMulUnsigned<uint64_t>(LeftValue, RightValue);
if (!Result)
return make_error<OverflowError>();