[PATCH] D142026: Optimize OptTable::findNearest implementation and usage

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 08:22:08 PST 2023


nikic added inline comments.


================
Comment at: clang/lib/Driver/Driver.cpp:2475
     if (getOpts().findNearest(Value, Nearest, IncludedFlagsBitmask,
-                              ExcludedFlagsBitmask) <= 1) {
+                              ExcludedFlagsBitmask, 0, 1) <= 1) {
       Diag(clang::diag::err_drv_no_such_file_with_suggestion)
----------------
I think this changes MinimumLength from the default of 4 to 0?


================
Comment at: llvm/include/llvm/Option/OptTable.h:179
+  /// \param [in] MinimumDistance - Don't find options whose distance is greater
+  /// than this value.
   ///
----------------
Shouldn't this be MaximumDistance?


================
Comment at: llvm/lib/Option/OptTable.cpp:285
+      if (std::abs((signed)(CandidatePrefix.size() + CandidateName.size()) -
+                   (signed)NormalizedName.size()) > (signed)BestDistance) {
+        continue;
----------------
Should probably be `ssize_t` rather than `signed`?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142026/new/

https://reviews.llvm.org/D142026



More information about the llvm-commits mailing list