[Lldb-commits] [lldb] 9844085 - [lldb] Migrate away from ValueRange(std::nullopt) (NFC) (#145245)

via lldb-commits lldb-commits at lists.llvm.org
Sun Jun 22 16:31:38 PDT 2025


Author: Kazu Hirata
Date: 2025-06-22T16:31:34-07:00
New Revision: 9844085ea8132eae1086eaf55894db3904c189be

URL: https://github.com/llvm/llvm-project/commit/9844085ea8132eae1086eaf55894db3904c189be
DIFF: https://github.com/llvm/llvm-project/commit/9844085ea8132eae1086eaf55894db3904c189be.diff

LOG: [lldb] Migrate away from ValueRange(std::nullopt) (NFC) (#145245)

ArrayRef has a constructor that accepts std::nullopt.  This
constructor dates back to the days when we still had llvm::Optional.

Since the use of std::nullopt outside the context of std::optional is
kind of abuse and not intuitive to new comers, I would like to move
away from the constructor and eventually remove it.

This patch takes care of the lldb side of migration.

Added: 
    

Modified: 
    lldb/source/Symbol/Function.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 4fc793750f84f..6114eccd935ee 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -343,7 +343,7 @@ llvm::ArrayRef<std::unique_ptr<CallEdge>> Function::GetCallEdges() {
   Block &block = GetBlock(/*can_create*/true);
   SymbolFile *sym_file = block.GetSymbolFile();
   if (!sym_file)
-    return std::nullopt;
+    return {};
 
   // Lazily read call site information from the SymbolFile.
   m_call_edges = sym_file->ParseCallEdgesInFunction(GetID());


        


More information about the lldb-commits mailing list