diff options
author | Pavel Labath <pavel@labath.sk> | 2019-02-11 16:14:02 +0000 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2019-02-11 16:14:02 +0000 |
commit | bd334efd0aec3d26d7ace3c5f8b858b07e0bb9bd (patch) | |
tree | 48a468ce6ce77ac4fc7b841e80a753e8459b8ff1 /lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | |
parent | 5caa550649740ee39ec09cbb195129d1687ca880 (diff) | |
download | bcm5719-llvm-bd334efd0aec3d26d7ace3c5f8b858b07e0bb9bd.tar.gz bcm5719-llvm-bd334efd0aec3d26d7ace3c5f8b858b07e0bb9bd.zip |
Simplify ObjectFile::GetUUID
instead of returning the UUID through by-ref argument and a boolean
value indicating success, we can just return it directly. Since the UUID
class already has an invalid state, it can be used to denote the failure
without the additional bool.
llvm-svn: 353714
Diffstat (limited to 'lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp')
-rw-r--r-- | lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index b4c320f12fe..4046082c02c 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -916,7 +916,7 @@ size_t ObjectFileMachO::GetModuleSpecifications( spec.GetArchitecture() = GetArchitecture(header, data, data_offset); if (spec.GetArchitecture().IsValid()) { - GetUUID(header, data, data_offset, spec.GetUUID()); + spec.GetUUID() = GetUUID(header, data, data_offset); specs.Append(spec); } } @@ -4845,10 +4845,9 @@ void ObjectFileMachO::Dump(Stream *s) { } } -bool ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header, +UUID ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header, const lldb_private::DataExtractor &data, - lldb::offset_t lc_offset, - lldb_private::UUID &uuid) { + lldb::offset_t lc_offset) { uint32_t i; struct uuid_command load_cmd; @@ -4870,16 +4869,15 @@ bool ObjectFileMachO::GetUUID(const llvm::MachO::mach_header &header, 0xbb, 0x14, 0xf0, 0x0d}; if (!memcmp(uuid_bytes, opencl_uuid, 16)) - return false; + return UUID(); - uuid = UUID::fromOptionalData(uuid_bytes, 16); - return true; + return UUID::fromOptionalData(uuid_bytes, 16); } - return false; + return UUID(); } offset = cmd_offset + load_cmd.cmdsize; } - return false; + return UUID(); } static llvm::StringRef GetOSName(uint32_t cmd) { @@ -5066,14 +5064,14 @@ ObjectFileMachO::GetArchitecture(const llvm::MachO::mach_header &header, return arch; } -bool ObjectFileMachO::GetUUID(lldb_private::UUID *uuid) { +UUID ObjectFileMachO::GetUUID() { ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic); - return GetUUID(m_header, m_data, offset, *uuid); + return GetUUID(m_header, m_data, offset); } - return false; + return UUID(); } uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) { @@ -5553,8 +5551,7 @@ ObjectFile::Type ObjectFileMachO::CalculateType() { if (GetAddressByteSize() == 4) { // 32 bit kexts are just object files, but they do have a valid // UUID load command. - UUID uuid; - if (GetUUID(&uuid)) { + if (GetUUID()) { // this checking for the UUID load command is not enough we could // eventually look for the symbol named "OSKextGetCurrentIdentifier" as // this is required of kexts @@ -5597,8 +5594,7 @@ ObjectFile::Strata ObjectFileMachO::CalculateStrata() { { // 32 bit kexts are just object files, but they do have a valid // UUID load command. - UUID uuid; - if (GetUUID(&uuid)) { + if (GetUUID()) { // this checking for the UUID load command is not enough we could // eventually look for the symbol named "OSKextGetCurrentIdentifier" as // this is required of kexts |