summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Option/OptTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Option/OptTable.cpp')
-rw-r--r--llvm/lib/Option/OptTable.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Option/OptTable.cpp b/llvm/lib/Option/OptTable.cpp
index f85b9043091..dcd1cc46d96 100644
--- a/llvm/lib/Option/OptTable.cpp
+++ b/llvm/lib/Option/OptTable.cpp
@@ -277,8 +277,8 @@ unsigned OptTable::findNearest(StringRef Option, std::string &NearestString,
continue;
// Find the most appropriate prefix. For example, if a user asks for
// "--helm", suggest "--help" over "-help".
- StringRef Prefix;
- for (int P = 0; CandidateInfo.Prefixes[P]; P++) {
+ StringRef Prefix = CandidateInfo.Prefixes[0];
+ for (int P = 1; CandidateInfo.Prefixes[P]; P++) {
if (Option.startswith(CandidateInfo.Prefixes[P]))
Prefix = CandidateInfo.Prefixes[P];
}
OpenPOWER on IntegriCloud