diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /clang/lib/AST/Stmt.cpp | |
parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) |
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 8eae04d0d9fd..8744bba6c6d9 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -41,6 +41,7 @@ #include <algorithm> #include <cassert> #include <cstring> +#include <optional> #include <string> #include <type_traits> #include <utility> @@ -1001,18 +1002,18 @@ bool IfStmt::isObjCAvailabilityCheck() const { return isa<ObjCAvailabilityCheckExpr>(getCond()); } -Optional<Stmt *> IfStmt::getNondiscardedCase(const ASTContext &Ctx) { +std::optional<Stmt *> IfStmt::getNondiscardedCase(const ASTContext &Ctx) { if (!isConstexpr() || getCond()->isValueDependent()) - return None; + return std::nullopt; return !getCond()->EvaluateKnownConstInt(Ctx) ? getElse() : getThen(); } -Optional<const Stmt *> +std::optional<const Stmt *> IfStmt::getNondiscardedCase(const ASTContext &Ctx) const { - if (Optional<Stmt *> Result = + if (std::optional<Stmt *> Result = const_cast<IfStmt *>(this)->getNondiscardedCase(Ctx)) return *Result; - return None; + return std::nullopt; } ForStmt::ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, |