diff options
author | Craig Topper <craig.topper@gmail.com> | 2015-09-21 05:32:41 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2015-09-21 05:32:41 +0000 |
commit | 0013be16fff27ce7744210007e08ed7528212c65 (patch) | |
tree | 623d42291b99ad1b5a7972fca60ec30e7b6d235d /llvm/lib/Object/MachOObjectFile.cpp | |
parent | 18929c50694220481b53784dad9e7a5a7aaec919 (diff) | |
download | bcm5719-llvm-0013be16fff27ce7744210007e08ed7528212c65.tar.gz bcm5719-llvm-0013be16fff27ce7744210007e08ed7528212c65.zip |
Use makeArrayRef or None to avoid unnecessarily mentioning the ArrayRef type extra times. NFC
llvm-svn: 248140
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index d1faf7be3af..571ed7a14fb 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -2204,65 +2204,65 @@ MachOObjectFile::getLinkOptHintsLoadCommand() const { ArrayRef<uint8_t> MachOObjectFile::getDyldInfoRebaseOpcodes() const { if (!DyldInfoLoadCmd) - return ArrayRef<uint8_t>(); + return None; MachO::dyld_info_command DyldInfo = getStruct<MachO::dyld_info_command>(this, DyldInfoLoadCmd); const uint8_t *Ptr = reinterpret_cast<const uint8_t*>( getPtr(this, DyldInfo.rebase_off)); - return ArrayRef<uint8_t>(Ptr, DyldInfo.rebase_size); + return makeArrayRef(Ptr, DyldInfo.rebase_size); } ArrayRef<uint8_t> MachOObjectFile::getDyldInfoBindOpcodes() const { if (!DyldInfoLoadCmd) - return ArrayRef<uint8_t>(); + return None; MachO::dyld_info_command DyldInfo = getStruct<MachO::dyld_info_command>(this, DyldInfoLoadCmd); const uint8_t *Ptr = reinterpret_cast<const uint8_t*>( getPtr(this, DyldInfo.bind_off)); - return ArrayRef<uint8_t>(Ptr, DyldInfo.bind_size); + return makeArrayRef(Ptr, DyldInfo.bind_size); } ArrayRef<uint8_t> MachOObjectFile::getDyldInfoWeakBindOpcodes() const { if (!DyldInfoLoadCmd) - return ArrayRef<uint8_t>(); + return None; MachO::dyld_info_command DyldInfo = getStruct<MachO::dyld_info_command>(this, DyldInfoLoadCmd); const uint8_t *Ptr = reinterpret_cast<const uint8_t*>( getPtr(this, DyldInfo.weak_bind_off)); - return ArrayRef<uint8_t>(Ptr, DyldInfo.weak_bind_size); + return makeArrayRef(Ptr, DyldInfo.weak_bind_size); } ArrayRef<uint8_t> MachOObjectFile::getDyldInfoLazyBindOpcodes() const { if (!DyldInfoLoadCmd) - return ArrayRef<uint8_t>(); + return None; MachO::dyld_info_command DyldInfo = getStruct<MachO::dyld_info_command>(this, DyldInfoLoadCmd); const uint8_t *Ptr = reinterpret_cast<const uint8_t*>( getPtr(this, DyldInfo.lazy_bind_off)); - return ArrayRef<uint8_t>(Ptr, DyldInfo.lazy_bind_size); + return makeArrayRef(Ptr, DyldInfo.lazy_bind_size); } ArrayRef<uint8_t> MachOObjectFile::getDyldInfoExportsTrie() const { if (!DyldInfoLoadCmd) - return ArrayRef<uint8_t>(); + return None; MachO::dyld_info_command DyldInfo = getStruct<MachO::dyld_info_command>(this, DyldInfoLoadCmd); const uint8_t *Ptr = reinterpret_cast<const uint8_t*>( getPtr(this, DyldInfo.export_off)); - return ArrayRef<uint8_t>(Ptr, DyldInfo.export_size); + return makeArrayRef(Ptr, DyldInfo.export_size); } ArrayRef<uint8_t> MachOObjectFile::getUuid() const { if (!UuidLoadCmd) - return ArrayRef<uint8_t>(); + return None; // Returning a pointer is fine as uuid doesn't need endian swapping. const char *Ptr = UuidLoadCmd + offsetof(MachO::uuid_command, uuid); - return ArrayRef<uint8_t>(reinterpret_cast<const uint8_t *>(Ptr), 16); + return makeArrayRef(reinterpret_cast<const uint8_t *>(Ptr), 16); } StringRef MachOObjectFile::getStringTableData() const { |