[Lldb-commits] [lldb] [lldb] Use std::optional::value_of (NFC) (PR #140011)
via lldb-commits
lldb-commits at lists.llvm.org
Wed May 14 23:43:19 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/140011.diff
2 Files Affected:
- (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (+2-2)
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+4-4)
``````````diff
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());
``````````
</details>
https://github.com/llvm/llvm-project/pull/140011
More information about the lldb-commits
mailing list