[PATCH] D61373: Fix OptTable::findNearest() adding delimiter for free
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 1 07:07:57 PDT 2019
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.
================
Comment at: llvm/lib/Option/OptTable.cpp:294
+ std::string NormalizedName = LHS;
+ if (Option.find(Delimiter) == LHS.size())
----------------
How about:
```
StringRef LHS, RHS;
char Last = CandidateName.back();
std::string NormalizedName = Option;
if (Last == '=' || Last == ':') {
std::tie(LHS, RHS) = Option.split(Last);
NormalizedName = LHS;
if (Option.find(Last) == LHS.size())
NormalizedName += Last;
}
```
================
Comment at: llvm/unittests/Option/OptionParsingTest.cpp:301
+ // `-glormp` should have an editing distance of 1 to `-glormp=`.
+ EXPECT_EQ(1U, T.findNearest("--glormp", Nearest));
----------------
// `--glormp` should have an editing distance of 1 to `--glormp=`.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61373/new/
https://reviews.llvm.org/D61373
More information about the llvm-commits
mailing list