[PATCH] D41732: [Option] Add 'findNearest' method to catch typos

Jonathan Roelofs via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 5 04:48:17 PST 2018


jroelofs added inline comments.


================
Comment at: lib/Option/OptTable.cpp:301
+    StringRef NormalizedName =
+        (LHS.drop_front(Prefix.size()) + Delimiter).str();
+    unsigned Distance = CandidateName.edit_distance(
----------------
I think `NormalizedName` is also a dangling reference to a temporary. It needs to be a `std::string` since you're concatenating.


https://reviews.llvm.org/D41732





More information about the llvm-commits mailing list