mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 02:06:07 +00:00
[Support] Use StringRef::consume_front (NFC)
This commit is contained in:
parent
96f14ea618
commit
b5d6ea4d8b
@ -1630,10 +1630,8 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
|
||||
// otherwise feed it to the eating positional.
|
||||
ArgName = StringRef(argv[i] + 1);
|
||||
// Eat second dash.
|
||||
if (!ArgName.empty() && ArgName[0] == '-') {
|
||||
if (ArgName.consume_front("-"))
|
||||
HaveDoubleDash = true;
|
||||
ArgName = ArgName.substr(1);
|
||||
}
|
||||
|
||||
Handler = LookupLongOption(*ChosenSubCommand, ArgName, Value,
|
||||
LongOptionsUseDoubleDash, HaveDoubleDash);
|
||||
@ -1644,10 +1642,8 @@ bool CommandLineParser::ParseCommandLineOptions(int argc,
|
||||
} else { // We start with a '-', must be an argument.
|
||||
ArgName = StringRef(argv[i] + 1);
|
||||
// Eat second dash.
|
||||
if (!ArgName.empty() && ArgName[0] == '-') {
|
||||
if (ArgName.consume_front("-"))
|
||||
HaveDoubleDash = true;
|
||||
ArgName = ArgName.substr(1);
|
||||
}
|
||||
|
||||
Handler = LookupLongOption(*ChosenSubCommand, ArgName, Value,
|
||||
LongOptionsUseDoubleDash, HaveDoubleDash);
|
||||
|
@ -72,8 +72,7 @@ formatv_object_base::parseReplacementItem(StringRef Spec) {
|
||||
return ReplacementItem{};
|
||||
}
|
||||
RepString = RepString.trim();
|
||||
if (!RepString.empty() && RepString.front() == ',') {
|
||||
RepString = RepString.drop_front();
|
||||
if (RepString.consume_front(",")) {
|
||||
if (!consumeFieldLayout(RepString, Where, Align, Pad))
|
||||
assert(false && "Invalid replacement field layout specification!");
|
||||
}
|
||||
|
@ -85,9 +85,8 @@ bool VersionTuple::tryParse(StringRef input) {
|
||||
}
|
||||
|
||||
// If we're not done, parse the micro version, \.[0-9]+
|
||||
if (input[0] != '.')
|
||||
if (!input.consume_front("."))
|
||||
return true;
|
||||
input = input.substr(1);
|
||||
if (parseInt(input, micro))
|
||||
return true;
|
||||
|
||||
@ -97,9 +96,8 @@ bool VersionTuple::tryParse(StringRef input) {
|
||||
}
|
||||
|
||||
// If we're not done, parse the micro version, \.[0-9]+
|
||||
if (input[0] != '.')
|
||||
if (!input.consume_front("."))
|
||||
return true;
|
||||
input = input.substr(1);
|
||||
if (parseInt(input, build))
|
||||
return true;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user