[llvm] e51b18f - [Analysis] Use std::optional in CFLAndersAliasAnalysis.cpp (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 10:16:37 PST 2022
Author: Kazu Hirata
Date: 2022-11-25T10:16:32-08:00
New Revision: e51b18f0066ad50e0f889ebe3fff9b0706e2a788
URL: https://github.com/llvm/llvm-project/commit/e51b18f0066ad50e0f889ebe3fff9b0706e2a788
DIFF: https://github.com/llvm/llvm-project/commit/e51b18f0066ad50e0f889ebe3fff9b0706e2a788.diff
LOG: [Analysis] Use std::optional in CFLAndersAliasAnalysis.cpp (NFC)
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
Added:
Modified:
llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
index d70e1b21d768..d9afdd019a41 100644
--- a/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/CFLAndersAliasAnalysis.cpp
@@ -81,6 +81,7 @@
#include <cstddef>
#include <cstdint>
#include <functional>
+#include <optional>
#include <utility>
#include <vector>
@@ -351,12 +352,12 @@ static bool hasWriteOnlyState(StateSet Set) {
return (Set & StateSet(WriteOnlyStateMask)).any();
}
-static Optional<InterfaceValue>
+static std::optional<InterfaceValue>
getInterfaceValue(InstantiatedValue IValue,
const SmallVectorImpl<Value *> &RetVals) {
auto Val = IValue.Val;
- Optional<unsigned> Index;
+ std::optional<unsigned> Index;
if (auto Arg = dyn_cast<Argument>(Val))
Index = Arg->getArgNo() + 1;
else if (is_contained(RetVals, Val))
@@ -625,7 +626,7 @@ static void initializeWorkList(std::vector<WorkListItem> &WorkList,
}
}
-static Optional<InstantiatedValue> getNodeBelow(const CFLGraph &Graph,
+static std::optional<InstantiatedValue> getNodeBelow(const CFLGraph &Graph,
InstantiatedValue V) {
auto NodeBelow = InstantiatedValue{V.Val, V.DerefLevel + 1};
if (Graph.getNode(NodeBelow))
More information about the llvm-commits
mailing list