diff options
author | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2023-07-03 12:48:01 -0400 |
---|---|---|
committer | Felipe de Azevedo Piovezan <fpiovezan@apple.com> | 2023-07-03 17:12:06 -0400 |
commit | f470ab734c9bae9464faf6cff6530beb32ea44ba (patch) | |
tree | 5bbf614d470d24197b801c20c1afa294f770ca37 /lldb/source | |
parent | e578b3be24fc3986f46942aa1fdbf73ff8d34ace (diff) | |
download | llvm-f470ab734c9bae9464faf6cff6530beb32ea44ba.zip llvm-f470ab734c9bae9464faf6cff6530beb32ea44ba.tar.gz llvm-f470ab734c9bae9464faf6cff6530beb32ea44ba.tar.bz2 |
[lldb][nfc] Remove redundant nullptr check
The make_shared function never returns a nullptr, as such the test for nullptr
is not needed. We also move the empty string check earlier in the if
("oso_object"), as this is cheaper than loading the object file.
Differential Revision: https://reviews.llvm.org/D154365
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 1d79b13..1319337 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -471,18 +471,17 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo( oso_arch, oso_object ? &oso_object : nullptr, 0, oso_object ? comp_unit_info->oso_mod_time : llvm::sys::TimePoint<>()); - if (!comp_unit_info->oso_sp->module_sp || !comp_unit_info->oso_sp->module_sp->GetObjectFile()) { - if (oso_object && FileSystem::Instance().Exists(oso_file)) { - // If we are loading a .o file from a .a file the "oso_object" will - // have a valid value name and if the .a file exists, either the .o - // file didn't exist in the .a file or the mod time didn't match. - comp_unit_info->oso_load_error.SetErrorStringWithFormat( - "\"%s\" object from the \"%s\" archive: " - "either the .o file doesn't exist in the archive or the " - "modification time (0x%8.8x) of the .o file doesn't match", - oso_object.AsCString(), oso_file.GetPath().c_str(), - (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time)); - } + if (oso_object && !comp_unit_info->oso_sp->module_sp->GetObjectFile() && + FileSystem::Instance().Exists(oso_file)) { + // If we are loading a .o file from a .a file the "oso_object" will + // have a valid value name and if the .a file exists, either the .o + // file didn't exist in the .a file or the mod time didn't match. + comp_unit_info->oso_load_error.SetErrorStringWithFormat( + "\"%s\" object from the \"%s\" archive: " + "either the .o file doesn't exist in the archive or the " + "modification time (0x%8.8x) of the .o file doesn't match", + oso_object.AsCString(), oso_file.GetPath().c_str(), + (uint32_t)llvm::sys::toTimeT(comp_unit_info->oso_mod_time)); } } } |