Skip to content

Commit

Permalink
[lldb][NFC] Move all completer subclasses into source file
Browse files Browse the repository at this point in the history
They are all implementation details so let's keep them out of the interface.
Also makes this code more readable by keeping these small classes
not spread over header and source file.
  • Loading branch information
Teemperor committed Feb 12, 2020
1 parent 7e5d8a3 commit 572fc89
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 248 deletions.
88 changes: 0 additions & 88 deletions lldb/include/lldb/Interpreter/CommandCompletions.h
Expand Up @@ -94,94 +94,6 @@ class CommandCompletions {
static void VariablePath(CommandInterpreter &interpreter,
CompletionRequest &request, SearchFilter *searcher);

// The Completer class is a convenient base class for building searchers that
// go along with the SearchFilter passed to the standard Completer functions.
class Completer : public Searcher {
public:
Completer(CommandInterpreter &interpreter, CompletionRequest &request);

~Completer() override;

CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context,
Address *addr) override = 0;

lldb::SearchDepth GetDepth() override = 0;

virtual void DoCompletion(SearchFilter *filter) = 0;

protected:
CommandInterpreter &m_interpreter;
CompletionRequest &m_request;

private:
DISALLOW_COPY_AND_ASSIGN(Completer);
};

// SourceFileCompleter implements the source file completer
class SourceFileCompleter : public Completer {
public:
SourceFileCompleter(CommandInterpreter &interpreter,
CompletionRequest &request);

lldb::SearchDepth GetDepth() override;

Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context,
Address *addr) override;

void DoCompletion(SearchFilter *filter) override;

private:
FileSpecList m_matching_files;
const char *m_file_name;
const char *m_dir_name;

DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter);
};

// ModuleCompleter implements the module completer
class ModuleCompleter : public Completer {
public:
ModuleCompleter(CommandInterpreter &interpreter,
CompletionRequest &request);

lldb::SearchDepth GetDepth() override;

Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context,
Address *addr) override;

void DoCompletion(SearchFilter *filter) override;

private:
const char *m_file_name;
const char *m_dir_name;

DISALLOW_COPY_AND_ASSIGN(ModuleCompleter);
};

// SymbolCompleter implements the symbol completer
class SymbolCompleter : public Completer {
public:
SymbolCompleter(CommandInterpreter &interpreter,
CompletionRequest &request);

lldb::SearchDepth GetDepth() override;

Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
SymbolContext &context,
Address *addr) override;

void DoCompletion(SearchFilter *filter) override;

private:
RegularExpression m_regex;
typedef std::set<ConstString> collection;
collection m_match_set;

DISALLOW_COPY_AND_ASSIGN(SymbolCompleter);
};

private:
static CommonCompletionElement g_common_completions[];
};
Expand Down

0 comments on commit 572fc89

Please sign in to comment.