summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-02-16 02:06:01 +0000
committerVedant Kumar <vsk@apple.com>2016-02-16 02:06:01 +0000
commit98372e327b619188166a0645748c7d421e95df35 (patch)
tree93522e1b009fc7c00c5c488f0f5900ad25317a53 /llvm/lib
parentf114b40c7310d04b984dd0b0800718f74382d991 (diff)
downloadbcm5719-llvm-98372e327b619188166a0645748c7d421e95df35.tar.gz
bcm5719-llvm-98372e327b619188166a0645748c7d421e95df35.zip
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. llvm-svn: 260926
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Object/Archive.cpp17
-rw-r--r--llvm/lib/Support/YAMLParser.cpp2
2 files changed, 9 insertions, 10 deletions
diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp
index 99b0650c8b7..28fd27cdb9b 100644
--- a/llvm/lib/Object/Archive.cpp
+++ b/llvm/lib/Object/Archive.cpp
@@ -52,14 +52,14 @@ ErrorOr<uint32_t> ArchiveMemberHeader::getSize() const {
sys::fs::perms ArchiveMemberHeader::getAccessMode() const {
unsigned Ret;
- if (StringRef(AccessMode, sizeof(AccessMode)).rtrim(" ").getAsInteger(8, Ret))
+ if (StringRef(AccessMode, sizeof(AccessMode)).rtrim(' ').getAsInteger(8, Ret))
llvm_unreachable("Access mode is not an octal number.");
return static_cast<sys::fs::perms>(Ret);
}
sys::TimeValue ArchiveMemberHeader::getLastModified() const {
unsigned Seconds;
- if (StringRef(LastModified, sizeof(LastModified)).rtrim(" ")
+ if (StringRef(LastModified, sizeof(LastModified)).rtrim(' ')
.getAsInteger(10, Seconds))
llvm_unreachable("Last modified time not a decimal number.");
@@ -70,14 +70,14 @@ sys::TimeValue ArchiveMemberHeader::getLastModified() const {
unsigned ArchiveMemberHeader::getUID() const {
unsigned Ret;
- if (StringRef(UID, sizeof(UID)).rtrim(" ").getAsInteger(10, Ret))
+ if (StringRef(UID, sizeof(UID)).rtrim(' ').getAsInteger(10, Ret))
llvm_unreachable("UID time not a decimal number.");
return Ret;
}
unsigned ArchiveMemberHeader::getGID() const {
unsigned Ret;
- if (StringRef(GID, sizeof(GID)).rtrim(" ").getAsInteger(10, Ret))
+ if (StringRef(GID, sizeof(GID)).rtrim(' ').getAsInteger(10, Ret))
llvm_unreachable("GID time not a decimal number.");
return Ret;
}
@@ -108,7 +108,7 @@ Archive::Child::Child(const Archive *Parent, const char *Start,
StringRef Name = getRawName();
if (Name.startswith("#1/")) {
uint64_t NameSize;
- if (Name.substr(3).rtrim(" ").getAsInteger(10, NameSize))
+ if (Name.substr(3).rtrim(' ').getAsInteger(10, NameSize))
llvm_unreachable("Long name length is not an integer");
StartOfFile += NameSize;
}
@@ -197,7 +197,7 @@ ErrorOr<StringRef> Archive::Child::getName() const {
// It's a long name.
// Get the offset.
std::size_t offset;
- if (name.substr(1).rtrim(" ").getAsInteger(10, offset))
+ if (name.substr(1).rtrim(' ').getAsInteger(10, offset))
llvm_unreachable("Long name offset is not an integer");
// Verify it.
@@ -213,10 +213,9 @@ ErrorOr<StringRef> Archive::Child::getName() const {
return StringRef(addr);
} else if (name.startswith("#1/")) {
uint64_t name_size;
- if (name.substr(3).rtrim(" ").getAsInteger(10, name_size))
+ if (name.substr(3).rtrim(' ').getAsInteger(10, name_size))
llvm_unreachable("Long name length is not an ingeter");
- return Data.substr(sizeof(ArchiveMemberHeader), name_size)
- .rtrim(StringRef("\0", 1));
+ return Data.substr(sizeof(ArchiveMemberHeader), name_size).rtrim('\0');
}
// It's a simple name.
if (name[name.size() - 1] == '/')
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index c4384cafff6..620841c2d15 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -1911,7 +1911,7 @@ StringRef ScalarNode::getValue(SmallVectorImpl<char> &Storage) const {
return UnquotedValue;
}
// Plain or block.
- return Value.rtrim(" ");
+ return Value.rtrim(' ');
}
StringRef ScalarNode::unescapeDoubleQuoted( StringRef UnquotedValue
OpenPOWER on IntegriCloud