[PATCH] D46776: [Option] Fix PR37006 prefix choice in findNearest
Nico Weber via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 11 20:35:32 PDT 2018
thakis added a comment.
Thanks!
================
Comment at: lib/Option/OptTable.cpp:284
- Prefix = CandidateInfo.Prefixes[P];
- }
----------------
Shouldn't getting the longest prefix here be good enough? Something like this:
```
StringRef Prefix;
int PrefixLength = 0;
for (int P = 0; Candidateinfo.Prefixes[P]; P++) {
StringRef Candidate = CandidateInfo.Prefixes[P];
if (Candiate.size() > PrefixLength && Option.startswith(Candidate)) {
Prefix = Candidate;
PrefixLength = Candidate.size();
}
}
```
…and keep everything else the same?
Repository:
rL LLVM
https://reviews.llvm.org/D46776
More information about the llvm-commits
mailing list