[Lldb-commits] [PATCH] D49322: Narrow the CompletionRequest API to being append-only.

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 13 14:42:47 PDT 2018


teemperor created this revision.
teemperor added a reviewer: jingham.

We currently allow any completion handler to read and manipulate the list of matches we
calculated so far. This leads to a few problems:

Firstly, a completion handler's logic can now depend on previously calculated results
by another handlers. No completion handler should have such an implicit dependency,
but the current API makes it likely that this could happen (or already happens). Especially
the fact that some completion handler deleted all previously calculated results can mess
things up right now.

Secondly, all completion handlers have knowledge about our internal data structures with
this API. This makes refactoring this internal data structure much harder than it should be.
Especially planned changes like the support of descriptions for completions are currently
giant patches because we have to refactor every single completion handler.

This patch narrows the contract the CompletionRequest has with the different handlers to:

1. A handler can suggest a completion.
2. A handler can ask how many suggestions we already have.

Point 2 obviously means we still have a  dependency left between the different handlers, but
getting rid of this is too large to just append it to this patch.

Otherwise this patch just completely hides the internal StringList to the different handlers.

The CompletionRequest API now also ensures that the list of completions is unique and we
don't suggest the same value multiple times to the user. This property has been so far only
been ensured by the `Option` handler, but is now applied globally. This is part of this patch
as the OptionHandler is no longer able to implement this functionality itself.


https://reviews.llvm.org/D49322

Files:
  include/lldb/Utility/CompletionRequest.h
  source/Commands/CommandCompletions.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectMultiword.cpp
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectPlugin.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Commands/CommandObjectSettings.cpp
  source/Commands/CommandObjectTarget.cpp
  source/Core/FormatEntity.cpp
  source/Core/IOHandler.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectRegexCommand.cpp
  source/Interpreter/OptionValue.cpp
  source/Interpreter/OptionValueArch.cpp
  source/Interpreter/OptionValueBoolean.cpp
  source/Interpreter/OptionValueEnumeration.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  source/Interpreter/OptionValueUUID.cpp
  source/Interpreter/Options.cpp
  source/Symbol/Variable.cpp
  source/Utility/ArchSpec.cpp
  source/Utility/CompletionRequest.cpp
  unittests/Utility/CompletionRequestTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49322.155491.patch
Type: text/x-patch
Size: 38534 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180713/3937b311/attachment-0001.bin>


More information about the lldb-commits mailing list