Replace Optional::hasValue with has_value or operator bool. NFC
This commit is contained in:
parent
507125af3d
commit
7430894a65
|
@ -994,7 +994,7 @@ public:
|
|||
bool hasName(const std::string &FunctionName) const {
|
||||
auto Res =
|
||||
forEachName([&](StringRef Name) { return Name == FunctionName; });
|
||||
return Res.hasValue();
|
||||
return Res.has_value();
|
||||
}
|
||||
|
||||
/// Check if any of function names matches the given regex.
|
||||
|
|
|
@ -673,7 +673,7 @@ void DWARFRewriter::updateUnitDebugInfo(
|
|||
AttrOffset = AttrVal->Offset;
|
||||
Value = AttrVal->V;
|
||||
const Optional<uint64_t> Result = Value.getAsAddress();
|
||||
if (Result.hasValue()) {
|
||||
if (Result) {
|
||||
const uint64_t Address = *Result;
|
||||
uint64_t NewAddress = 0;
|
||||
if (const BinaryFunction *Function =
|
||||
|
|
|
@ -2739,7 +2739,7 @@ void RewriteInstance::selectFunctionsToProcess() {
|
|||
Function.forEachName([&ForceFunctionsNR](StringRef Name) {
|
||||
return ForceFunctionsNR.count(Name.str());
|
||||
});
|
||||
return Match.hasValue();
|
||||
return Match.has_value();
|
||||
}
|
||||
|
||||
for (std::string &Name : opts::SkipFunctionNames)
|
||||
|
|
|
@ -77,9 +77,9 @@ TEST_P(BinaryContextTester, BaseAddress) {
|
|||
|
||||
Optional<uint64_t> BaseAddress =
|
||||
BC->getBaseAddressForMapping(0x7f13f5556000, 0x10e8c000);
|
||||
ASSERT_TRUE(BaseAddress.hasValue());
|
||||
ASSERT_TRUE(BaseAddress.has_value());
|
||||
ASSERT_EQ(*BaseAddress, 0x7f13e46c9000ULL);
|
||||
|
||||
BaseAddress = BC->getBaseAddressForMapping(0x7f13f5556000, 0x137a000);
|
||||
ASSERT_FALSE(BaseAddress.hasValue());
|
||||
ASSERT_FALSE(BaseAddress.has_value());
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ TEST_P(MCPlusBuilderTester, Annotation) {
|
|||
BC->MIB->addEHInfo(Inst, MCPlus::MCLandingPad(LPSymbol, Value));
|
||||
// Round-trip encoding-decoding check for negative values
|
||||
Optional<MCPlus::MCLandingPad> EHInfo = BC->MIB->getEHInfo(Inst);
|
||||
ASSERT_TRUE(EHInfo.hasValue());
|
||||
ASSERT_TRUE(EHInfo.has_value());
|
||||
MCPlus::MCLandingPad LP = EHInfo.getValue();
|
||||
uint64_t DecodedValue = LP.second;
|
||||
ASSERT_EQ(Value, DecodedValue);
|
||||
|
|
|
@ -1185,7 +1185,7 @@ Error OffloadBundler::UnbundleArchive() {
|
|||
|
||||
Optional<StringRef> OptionalCurBundleID = *CurBundleIDOrErr;
|
||||
// No device code in this child, skip.
|
||||
if (!OptionalCurBundleID.hasValue())
|
||||
if (!OptionalCurBundleID)
|
||||
continue;
|
||||
StringRef CodeObject = *OptionalCurBundleID;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -224,7 +224,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
: ExprAST(Expr_Return, std::move(loc)), expr(std::move(expr)) {}
|
||||
|
||||
llvm::Optional<ExprAST *> getExpr() {
|
||||
if (expr.hasValue())
|
||||
if (expr.has_value())
|
||||
return expr->get();
|
||||
return llvm::None;
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ private:
|
|||
|
||||
// 'return' takes an optional expression, handle that case here.
|
||||
mlir::Value expr = nullptr;
|
||||
if (ret.getExpr().hasValue()) {
|
||||
if (ret.getExpr().has_value()) {
|
||||
if (!(expr = mlirGen(*ret.getExpr().value())))
|
||||
return mlir::failure();
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ void ASTDumper::dump(VariableExprAST *node) {
|
|||
void ASTDumper::dump(ReturnExprAST *node) {
|
||||
INDENT();
|
||||
llvm::errs() << "Return\n";
|
||||
if (node->getExpr().hasValue())
|
||||
if (node->getExpr().has_value())
|
||||
return dump(*node->getExpr());
|
||||
{
|
||||
INDENT();
|
||||
|
|
Loading…
Reference in New Issue
Block a user