[all-commits] [llvm/llvm-project] d554f2: [lldb] Fix module name tab completion (#93458)

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu May 30 00:57:34 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d554f2379b427505907ba52b8b9270c0b436224f
      https://github.com/llvm/llvm-project/commit/d554f2379b427505907ba52b8b9270c0b436224f
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2024-05-30 (Thu, 30 May 2024)

  Changed paths:
    M lldb/source/Commands/CommandCompletions.cpp
    M lldb/test/API/functionalities/completion/TestCompletion.py

  Log Message:
  -----------
  [lldb] Fix module name tab completion (#93458)

Module names can be matched either by a full path or just their
basename. The completion machinery tried to do both, but had several
bugs:
- it always inserted the basename as a completion candidate, even if the
string being completed was a full path
- due to FileSpec canonicalization, it lost information about trailing
slashes (it treated "lib/<TAB>" as "lib<TAB>", even though it's clear
the former was trying to complete a directory name)
- due to both of the previous issues, the completion candidates could
end up being shorter than the string being completed, which caused
crashes (string out of range errors) when attempting to substitute the
results.

This patch rewrites to logic to remove these kinds of issues:
- basename and full path completion are handled separately
- full path completion is attempted always, basename only if the input
string does not contain a slash
- the code remembers both the canonical and original spelling or the
completed argument. The canonical arg is used for matching, while the
original spelling is used for completion. This way "/foo///.//b<TAB>"
can still match "/foo/bar", but it will complete to "/foo///.//bar".



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list