aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/CommandLine.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-01-13 18:18:49 -0800
committerKazu Hirata <kazu@google.com>2024-01-13 18:18:49 -0800
commitb5d6ea4d8b195558f1b79970368b185d232754d9 (patch)
tree50f167a29735ddde55ca304b69d277959a8f7365 /llvm/lib/Support/CommandLine.cpp
parent96f14ea61847da9b89732cd86ff2ba5ceac252d3 (diff)
downloadllvm-b5d6ea4d8b195558f1b79970368b185d232754d9.zip
llvm-b5d6ea4d8b195558f1b79970368b185d232754d9.tar.gz
llvm-b5d6ea4d8b195558f1b79970368b185d232754d9.tar.bz2
[Support] Use StringRef::consume_front (NFC)
Diffstat (limited to 'llvm/lib/Support/CommandLine.cpp')
-rw-r--r--llvm/lib/Support/CommandLine.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index 553669c..cb9eb91 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -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);