[Lldb-commits] [lldb] [lldb] Use std::optional::value_of (NFC) (PR #140011)
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Wed May 14 23:42:48 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/140011
None
>From cb827a2d99f3d700378ddbe4064b60281c5ef85e Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 14 May 2025 23:29:42 -0700
Subject: [PATCH] [lldb] Use std::optional::value_of (NFC)
---
.../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 4 ++--
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index a3e809f44ed23..e3a866e2b6d48 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2479,8 +2479,8 @@ Function *DWARFASTParserClang::ParseFunctionFromDWARF(
std::unique_ptr<Declaration> decl_up;
if (decl_file || decl_line || decl_column)
decl_up = std::make_unique<Declaration>(
- die.GetCU()->GetFile(decl_file ? *decl_file : 0),
- decl_line ? *decl_line : 0, decl_column ? *decl_column : 0);
+ die.GetCU()->GetFile(decl_file.value_or(0)), decl_line.value_or(0),
+ decl_column.value_or(0));
SymbolFileDWARF *dwarf = die.GetDWARF();
// Supply the type _only_ if it has already been parsed
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 907d63eb51afe..0fc7f79be70ec 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1358,15 +1358,15 @@ size_t SymbolFileDWARF::ParseBlocksRecursive(CompileUnit &comp_unit,
if (decl_file || decl_line || decl_column)
decl_up = std::make_unique<Declaration>(
comp_unit.GetSupportFiles().GetFileSpecAtIndex(
- decl_file ? *decl_file : 0),
- decl_line ? *decl_line : 0, decl_column ? *decl_column : 0);
+ decl_file.value_or(0)),
+ decl_line.value_or(0), decl_column.value_or(0));
std::unique_ptr<Declaration> call_up;
if (call_file || call_line || call_column)
call_up = std::make_unique<Declaration>(
comp_unit.GetSupportFiles().GetFileSpecAtIndex(
- call_file ? *call_file : 0),
- call_line ? *call_line : 0, call_column ? *call_column : 0);
+ call_file.value_or(0)),
+ call_line.value_or(0), call_column.value_or(0));
block->SetInlinedFunctionInfo(name, mangled_name, decl_up.get(),
call_up.get());
More information about the lldb-commits
mailing list