Skip to content

Commit 90e9c6e

Browse files
[llvm] Use StringRef::consume_front (NFC)
1 parent dcb8369 commit 90e9c6e

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

llvm/lib/Object/COFFModuleDefinition.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ class Lexer {
9797
}
9898
case '=':
9999
Buf = Buf.drop_front();
100-
if (Buf.starts_with("=")) {
101-
Buf = Buf.drop_front();
100+
if (Buf.consume_front("="))
102101
return Token(EqualEqual, "==");
103-
}
104102
return Token(Equal, "=");
105103
case ',':
106104
Buf = Buf.drop_front();

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,8 +1816,7 @@ std::string DotCfgDiffNode::getBodyContent() const {
18161816
for (unsigned I = 0; I < 2; ++I) {
18171817
SR[I] = Data[I]->getBody();
18181818
// drop initial '\n' if present
1819-
if (SR[I][0] == '\n')
1820-
SR[I] = SR[I].drop_front();
1819+
SR[I].consume_front("\n");
18211820
// drop predecessors as they can be big and are redundant
18221821
SR[I] = SR[I].drop_until([](char C) { return C == '\n'; }).drop_front();
18231822
}

llvm/lib/Support/FormatVariadic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ formatv_object_base::parseReplacementItem(StringRef Spec) {
7777
assert(false && "Invalid replacement field layout specification!");
7878
}
7979
RepString = RepString.trim();
80-
if (!RepString.empty() && RepString.front() == ':') {
81-
Options = RepString.drop_front().trim();
80+
if (RepString.consume_front(":")) {
81+
Options = RepString.trim();
8282
RepString = StringRef();
8383
}
8484
RepString = RepString.trim();

0 commit comments

Comments
 (0)