aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Analysis/ReachableCode.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-01-14 12:31:01 -0800
committerKazu Hirata <kazu@google.com>2023-01-14 12:31:01 -0800
commit6ad0788c332bb2043142954d300c49ac3e537f34 (patch)
treea67542ce4ca8dbcc65ef3cd01e76ff9cb861208b /clang/lib/Analysis/ReachableCode.cpp
parentff39b7ea89476c78177aff5cb0ddb441e74c8838 (diff)
downloadllvm-6ad0788c332bb2043142954d300c49ac3e537f34.zip
llvm-6ad0788c332bb2043142954d300c49ac3e537f34.tar.gz
llvm-6ad0788c332bb2043142954d300c49ac3e537f34.tar.bz2
[clang] Use std::optional instead of llvm::Optional (NFC)
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". 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
Diffstat (limited to 'clang/lib/Analysis/ReachableCode.cpp')
-rw-r--r--clang/lib/Analysis/ReachableCode.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Analysis/ReachableCode.cpp b/clang/lib/Analysis/ReachableCode.cpp
index a375521..5cc63bb 100644
--- a/clang/lib/Analysis/ReachableCode.cpp
+++ b/clang/lib/Analysis/ReachableCode.cpp
@@ -74,7 +74,7 @@ static bool isBuiltinAssumeFalse(const CFGBlock *B, const Stmt *S,
// (e.g. a CFGBlock containing only a goto).
return false;
}
- if (Optional<CFGStmt> CS = B->back().getAs<CFGStmt>()) {
+ if (std::optional<CFGStmt> CS = B->back().getAs<CFGStmt>()) {
if (const auto *CE = dyn_cast<CallExpr>(CS->getStmt())) {
return CE->getCallee()->IgnoreCasts() == S && CE->isBuiltinAssumeFalse(C);
}
@@ -89,7 +89,7 @@ static bool isDeadReturn(const CFGBlock *B, const Stmt *S) {
const CFGBlock *Current = B;
while (true) {
for (const CFGElement &CE : llvm::reverse(*Current)) {
- if (Optional<CFGStmt> CS = CE.getAs<CFGStmt>()) {
+ if (std::optional<CFGStmt> CS = CE.getAs<CFGStmt>()) {
if (const ReturnStmt *RS = dyn_cast<ReturnStmt>(CS->getStmt())) {
if (RS == S)
return true;
@@ -340,7 +340,7 @@ static unsigned scanFromBlock(const CFGBlock *Start,
// This allows us to potentially uncover some "always unreachable" code
// within the "sometimes unreachable" code.
// Look at the successors and mark then reachable.
- Optional<bool> TreatAllSuccessorsAsReachable;
+ std::optional<bool> TreatAllSuccessorsAsReachable;
if (!IncludeSometimesUnreachableEdges)
TreatAllSuccessorsAsReachable = false;
@@ -462,7 +462,7 @@ static bool isValidDeadStmt(const Stmt *S) {
const Stmt *DeadCodeScan::findDeadCode(const clang::CFGBlock *Block) {
for (CFGBlock::const_iterator I = Block->begin(), E = Block->end(); I!=E; ++I)
- if (Optional<CFGStmt> CS = I->getAs<CFGStmt>()) {
+ if (std::optional<CFGStmt> CS = I->getAs<CFGStmt>()) {
const Stmt *S = CS->getStmt();
if (isValidDeadStmt(S))
return S;