llvm.org GIT mirror llvm / 7e9bf09
Simplify users of StringRef::{l,r}trim (NFC) r260925 introduced a version of the *trim methods which is preferable when trimming a single kind of character. Update all users in llvm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260926 91177308-0d34-0410-b5e6-96231b3b80d8 Vedant Kumar 4 years ago
3 changed file(s) with 10 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
4141 sys::fs::perms getAccessMode() const;
4242 sys::TimeValue getLastModified() const;
4343 llvm::StringRef getRawLastModified() const {
44 return StringRef(LastModified, sizeof(LastModified)).rtrim(" ");
44 return StringRef(LastModified, sizeof(LastModified)).rtrim(' ');
4545 }
4646 unsigned getUID() const;
4747 unsigned getGID() const;
5151
5252 sys::fs::perms ArchiveMemberHeader::getAccessMode() const {
5353 unsigned Ret;
54 if (StringRef(AccessMode, sizeof(AccessMode)).rtrim(" ").getAsInteger(8, Ret))
54 if (StringRef(AccessMode, sizeof(AccessMode)).rtrim(' ').getAsInteger(8, Ret))
5555 llvm_unreachable("Access mode is not an octal number.");
5656 return static_cast(Ret);
5757 }
5858
5959 sys::TimeValue ArchiveMemberHeader::getLastModified() const {
6060 unsigned Seconds;
61 if (StringRef(LastModified, sizeof(LastModified)).rtrim(" ")
61 if (StringRef(LastModified, sizeof(LastModified)).rtrim(' ')
6262 .getAsInteger(10, Seconds))
6363 llvm_unreachable("Last modified time not a decimal number.");
6464
6969
7070 unsigned ArchiveMemberHeader::getUID() const {
7171 unsigned Ret;
72 if (StringRef(UID, sizeof(UID)).rtrim(" ").getAsInteger(10, Ret))
72 if (StringRef(UID, sizeof(UID)).rtrim(' ').getAsInteger(10, Ret))
7373 llvm_unreachable("UID time not a decimal number.");
7474 return Ret;
7575 }
7676
7777 unsigned ArchiveMemberHeader::getGID() const {
7878 unsigned Ret;
79 if (StringRef(GID, sizeof(GID)).rtrim(" ").getAsInteger(10, Ret))
79 if (StringRef(GID, sizeof(GID)).rtrim(' ').getAsInteger(10, Ret))
8080 llvm_unreachable("GID time not a decimal number.");
8181 return Ret;
8282 }
107107 StringRef Name = getRawName();
108108 if (Name.startswith("#1/")) {
109109 uint64_t NameSize;
110 if (Name.substr(3).rtrim(" ").getAsInteger(10, NameSize))
110 if (Name.substr(3).rtrim(' ').getAsInteger(10, NameSize))
111111 llvm_unreachable("Long name length is not an integer");
112112 StartOfFile += NameSize;
113113 }
196196 // It's a long name.
197197 // Get the offset.
198198 std::size_t offset;
199 if (name.substr(1).rtrim(" ").getAsInteger(10, offset))
199 if (name.substr(1).rtrim(' ').getAsInteger(10, offset))
200200 llvm_unreachable("Long name offset is not an integer");
201201
202202 // Verify it.
212212 return StringRef(addr);
213213 } else if (name.startswith("#1/")) {
214214 uint64_t name_size;
215 if (name.substr(3).rtrim(" ").getAsInteger(10, name_size))
215 if (name.substr(3).rtrim(' ').getAsInteger(10, name_size))
216216 llvm_unreachable("Long name length is not an ingeter");
217 return Data.substr(sizeof(ArchiveMemberHeader), name_size)
218 .rtrim(StringRef("\0", 1));
217 return Data.substr(sizeof(ArchiveMemberHeader), name_size).rtrim('\0');
219218 }
220219 // It's a simple name.
221220 if (name[name.size() - 1] == '/')
19101910 return UnquotedValue;
19111911 }
19121912 // Plain or block.
1913 return Value.rtrim(" ");
1913 return Value.rtrim(' ');
19141914 }
19151915
19161916 StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue