[IR] Use std::optional in PassManager.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Fri, 25 Nov 2022 20:08:56 +0000 (12:08 -0800)
committerKazu Hirata <kazu@google.com>
Fri, 25 Nov 2022 20:08:56 +0000 (12:08 -0800)
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

llvm/lib/IR/PassManager.cpp

index 9769899..a2e9a7c 100644 (file)
@@ -10,6 +10,7 @@
 #include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/IR/PassManagerImpl.h"
+#include <optional>
 
 using namespace llvm;
 
@@ -54,7 +55,7 @@ bool FunctionAnalysisManagerModuleProxy::Result::invalidate(
   // Now walk all the functions to see if any inner analysis invalidation is
   // necessary.
   for (Function &F : M) {
-    Optional<PreservedAnalyses> FunctionPA;
+    std::optional<PreservedAnalyses> FunctionPA;
 
     // Check to see whether the preserved set needs to be pruned based on
     // module-level analysis invalidation that triggers deferred invalidation