[llvm] 5047104 - [Analysis] Use std::optional in LazyCallGraph.h (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 27 11:49:26 PST 2022


Author: Kazu Hirata
Date: 2022-11-27T11:49:06-08:00
New Revision: 5047104a76445bb424e480594f0eb2ed768315b3

URL: https://github.com/llvm/llvm-project/commit/5047104a76445bb424e480594f0eb2ed768315b3
DIFF: https://github.com/llvm/llvm-project/commit/5047104a76445bb424e480594f0eb2ed768315b3.diff

LOG: [Analysis] Use std::optional in LazyCallGraph.h (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/include/llvm/Analysis/LazyCallGraph.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Analysis/LazyCallGraph.h b/llvm/include/llvm/Analysis/LazyCallGraph.h
index a25b2166634a..0cd8e8a02b17 100644
--- a/llvm/include/llvm/Analysis/LazyCallGraph.h
+++ b/llvm/include/llvm/Analysis/LazyCallGraph.h
@@ -49,6 +49,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <iterator>
+#include <optional>
 #include <string>
 #include <utility>
 
@@ -311,7 +312,7 @@ class LazyCallGraph {
   /// The node works much like an optional in order to lazily populate the
   /// edges of each node. Until populated, there are no edges. Once populated,
   /// you can access the edges by dereferencing the node or using the `->`
-  /// operator as if the node was an `Optional<EdgeSequence>`.
+  /// operator as if the node was an `std::optional<EdgeSequence>`.
   class Node {
     friend class LazyCallGraph;
     friend class LazyCallGraph::RefSCC;
@@ -378,7 +379,7 @@ class LazyCallGraph {
     int DFSNumber = 0;
     int LowLink = 0;
 
-    Optional<EdgeSequence> Edges;
+    std::optional<EdgeSequence> Edges;
 
     /// Basic constructor implements the scanning of F into Edges and
     /// EdgeIndexMap.


        


More information about the llvm-commits mailing list