[llvm] 286223e - [llvm-profgen] Use std::optional in ProfiledBinary.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 26 19:01:29 PST 2022


Author: Kazu Hirata
Date: 2022-11-26T19:01:24-08:00
New Revision: 286223edc62a039fb5e1c6468fda3486dfb9e1af

URL: https://github.com/llvm/llvm-project/commit/286223edc62a039fb5e1c6468fda3486dfb9e1af
DIFF: https://github.com/llvm/llvm-project/commit/286223edc62a039fb5e1c6468fda3486dfb9e1af.diff

LOG: [llvm-profgen] Use std::optional in ProfiledBinary.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/tools/llvm-profgen/ProfiledBinary.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-profgen/ProfiledBinary.cpp b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
index f639fcc9f64bc..1de06f96eff36 100644
--- a/llvm/tools/llvm-profgen/ProfiledBinary.cpp
+++ b/llvm/tools/llvm-profgen/ProfiledBinary.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/TargetSelect.h"
+#include <optional>
 
 #define DEBUG_TYPE "load-binary"
 
@@ -87,7 +88,7 @@ BinarySizeContextTracker::getFuncSizeForContext(const ContextTrieNode *Node) {
   ContextTrieNode *CurrNode = &RootContext;
   ContextTrieNode *PrevNode = nullptr;
 
-  Optional<uint32_t> Size;
+  std::optional<uint32_t> Size;
 
   // Start from top-level context-less function, traverse down the reverse
   // context trie to find the best/longest match for given context, then


        


More information about the llvm-commits mailing list