diff options
author | David Blaikie <dblaikie@gmail.com> | 2016-08-01 21:50:43 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2016-08-01 21:50:43 +0000 |
commit | cd842eccbabfb9f4480d5de0c4cac2eb6e88f570 (patch) | |
tree | 71eda76b8d1cb7a873a248bb02f504e30623d55c /llvm/lib/Object | |
parent | c40618610f4ce701af2afb8ea0cb722f3107bf68 (diff) | |
download | bcm5719-llvm-cd842eccbabfb9f4480d5de0c4cac2eb6e88f570.tar.gz bcm5719-llvm-cd842eccbabfb9f4480d5de0c4cac2eb6e88f570.zip |
Simplify some code found when it was moved in r277177
llvm-svn: 277394
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r-- | llvm/lib/Object/Archive.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index c509124d9be..586f9c1da81 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -166,8 +166,10 @@ Expected<StringRef> ArchiveMemberHeader::getName(uint64_t Size) const { StringRef::size_type End = StringRef(addr).find('\n'); return StringRef(addr, End - 1); } - return StringRef(addr); - } else if (Name.startswith("#1/")) { + return addr; + } + + if (Name.startswith("#1/")) { uint64_t NameLength; if (Name.substr(3).rtrim(' ').getAsInteger(10, NameLength)) { std::string Buf; @@ -191,16 +193,14 @@ Expected<StringRef> ArchiveMemberHeader::getName(uint64_t Size) const { } return StringRef(reinterpret_cast<const char *>(ArMemHdr) + getSizeOf(), NameLength).rtrim('\0'); - } else { - // It is not a long name so trim the blanks at the end of the name. - if (Name[Name.size() - 1] != '/') { - return Name.rtrim(' '); - } } + + // It is not a long name so trim the blanks at the end of the name. + if (Name[Name.size() - 1] != '/') + return Name.rtrim(' '); + // It's a simple name. - if (Name[Name.size() - 1] == '/') - return Name.substr(0, Name.size() - 1); - return Name; + return Name.drop_back(1); } Expected<uint32_t> ArchiveMemberHeader::getSize() const { |