mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 23:57:48 +00:00
Simplify some code found when it was moved in r277177
llvm-svn: 277394
This commit is contained in:
parent
3948eae2ef
commit
f272aeda18
@ -166,8 +166,10 @@ Expected<StringRef> ArchiveMemberHeader::getName(uint64_t Size) const {
|
|||||||
StringRef::size_type End = StringRef(addr).find('\n');
|
StringRef::size_type End = StringRef(addr).find('\n');
|
||||||
return StringRef(addr, End - 1);
|
return StringRef(addr, End - 1);
|
||||||
}
|
}
|
||||||
return StringRef(addr);
|
return addr;
|
||||||
} else if (Name.startswith("#1/")) {
|
}
|
||||||
|
|
||||||
|
if (Name.startswith("#1/")) {
|
||||||
uint64_t NameLength;
|
uint64_t NameLength;
|
||||||
if (Name.substr(3).rtrim(' ').getAsInteger(10, NameLength)) {
|
if (Name.substr(3).rtrim(' ').getAsInteger(10, NameLength)) {
|
||||||
std::string Buf;
|
std::string Buf;
|
||||||
@ -191,16 +193,14 @@ Expected<StringRef> ArchiveMemberHeader::getName(uint64_t Size) const {
|
|||||||
}
|
}
|
||||||
return StringRef(reinterpret_cast<const char *>(ArMemHdr) + getSizeOf(),
|
return StringRef(reinterpret_cast<const char *>(ArMemHdr) + getSizeOf(),
|
||||||
NameLength).rtrim('\0');
|
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.
|
// It's a simple name.
|
||||||
if (Name[Name.size() - 1] == '/')
|
return Name.drop_back(1);
|
||||||
return Name.substr(0, Name.size() - 1);
|
|
||||||
return Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Expected<uint32_t> ArchiveMemberHeader::getSize() const {
|
Expected<uint32_t> ArchiveMemberHeader::getSize() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user