aboutsummaryrefslogtreecommitdiff
path: root/mlir/examples
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-07-29 10:57:25 -0700
committerFangrui Song <i@maskray.me>2022-07-29 10:57:25 -0700
commit7430894a6573665c18b97599db76a331fa0b25eb (patch)
treeeb02ffc4ef944ba97efe3fb05cdca4b609a2eb50 /mlir/examples
parent507125af3d0b953cb56bce2e5b8000249fe1ef53 (diff)
downloadllvm-7430894a6573665c18b97599db76a331fa0b25eb.zip
llvm-7430894a6573665c18b97599db76a331fa0b25eb.tar.gz
llvm-7430894a6573665c18b97599db76a331fa0b25eb.tar.bz2
Replace Optional::hasValue with has_value or operator bool. NFC
Diffstat (limited to 'mlir/examples')
-rw-r--r--mlir/examples/toy/Ch1/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch1/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch2/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch2/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch2/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch3/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch3/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch3/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch4/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch4/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch4/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch5/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch5/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch5/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch6/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch6/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch6/parser/AST.cpp2
-rw-r--r--mlir/examples/toy/Ch7/include/toy/AST.h2
-rw-r--r--mlir/examples/toy/Ch7/mlir/MLIRGen.cpp2
-rw-r--r--mlir/examples/toy/Ch7/parser/AST.cpp2
20 files changed, 20 insertions, 20 deletions
diff --git a/mlir/examples/toy/Ch1/include/toy/AST.h b/mlir/examples/toy/Ch1/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch1/include/toy/AST.h
+++ b/mlir/examples/toy/Ch1/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch1/parser/AST.cpp b/mlir/examples/toy/Ch1/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch1/parser/AST.cpp
+++ b/mlir/examples/toy/Ch1/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch2/include/toy/AST.h b/mlir/examples/toy/Ch2/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch2/include/toy/AST.h
+++ b/mlir/examples/toy/Ch2/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
index d929da8..167c807 100644
--- a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch2/parser/AST.cpp b/mlir/examples/toy/Ch2/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch2/parser/AST.cpp
+++ b/mlir/examples/toy/Ch2/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch3/include/toy/AST.h b/mlir/examples/toy/Ch3/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch3/include/toy/AST.h
+++ b/mlir/examples/toy/Ch3/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
index d929da8..167c807 100644
--- a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch3/parser/AST.cpp b/mlir/examples/toy/Ch3/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch3/parser/AST.cpp
+++ b/mlir/examples/toy/Ch3/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch4/include/toy/AST.h b/mlir/examples/toy/Ch4/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch4/include/toy/AST.h
+++ b/mlir/examples/toy/Ch4/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
index 7bc9080..0d586e0 100644
--- a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch4/parser/AST.cpp b/mlir/examples/toy/Ch4/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch4/parser/AST.cpp
+++ b/mlir/examples/toy/Ch4/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch5/include/toy/AST.h b/mlir/examples/toy/Ch5/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch5/include/toy/AST.h
+++ b/mlir/examples/toy/Ch5/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
index 7bc9080..0d586e0 100644
--- a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch5/parser/AST.cpp b/mlir/examples/toy/Ch5/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch5/parser/AST.cpp
+++ b/mlir/examples/toy/Ch5/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch6/include/toy/AST.h b/mlir/examples/toy/Ch6/include/toy/AST.h
index 95bcd67..f3a30fc 100644
--- a/mlir/examples/toy/Ch6/include/toy/AST.h
+++ b/mlir/examples/toy/Ch6/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
index 7bc9080..0d586e0 100644
--- a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch6/parser/AST.cpp b/mlir/examples/toy/Ch6/parser/AST.cpp
index 875b2e2..2eaabb1 100644
--- a/mlir/examples/toy/Ch6/parser/AST.cpp
+++ b/mlir/examples/toy/Ch6/parser/AST.cpp
@@ -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();
diff --git a/mlir/examples/toy/Ch7/include/toy/AST.h b/mlir/examples/toy/Ch7/include/toy/AST.h
index 10f8256..665b8d5 100644
--- a/mlir/examples/toy/Ch7/include/toy/AST.h
+++ b/mlir/examples/toy/Ch7/include/toy/AST.h
@@ -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;
}
diff --git a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
index 2fcf8cc..8f2420c 100644
--- a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
@@ -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();
}
diff --git a/mlir/examples/toy/Ch7/parser/AST.cpp b/mlir/examples/toy/Ch7/parser/AST.cpp
index 5ee5c4e..3542f8f 100644
--- a/mlir/examples/toy/Ch7/parser/AST.cpp
+++ b/mlir/examples/toy/Ch7/parser/AST.cpp
@@ -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();