1 //===-- CommandCompletions.h ------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
10 #define LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
11 
12 #include <set>
13 
14 #include "lldb/Core/FileSpecList.h"
15 #include "lldb/Core/SearchFilter.h"
16 #include "lldb/Utility/CompletionRequest.h"
17 #include "lldb/Utility/RegularExpression.h"
18 #include "lldb/lldb-private.h"
19 
20 #include "llvm/ADT/Twine.h"
21 
22 namespace lldb_private {
23 class TildeExpressionResolver;
24 class CommandCompletions {
25 public:
26   enum CommonCompletionTypes {
27     eNoCompletion = 0u,
28     eSourceFileCompletion = (1u << 0),
29     eDiskFileCompletion = (1u << 1),
30     eDiskDirectoryCompletion = (1u << 2),
31     eSymbolCompletion = (1u << 3),
32     eModuleCompletion = (1u << 4),
33     eSettingsNameCompletion = (1u << 5),
34     ePlatformPluginCompletion = (1u << 6),
35     eArchitectureCompletion = (1u << 7),
36     eVariablePathCompletion = (1u << 8),
37     eRegisterCompletion = (1u << 9),
38     eBreakpointCompletion = (1u << 10),
39     eProcessPluginCompletion = (1u << 11),
40     eDisassemblyFlavorCompletion = (1u << 12),
41     eTypeLanguageCompletion = (1u << 13),
42     eFrameIndexCompletion = (1u << 14),
43     eModuleUUIDCompletion = (1u << 15),
44     eStopHookIDCompletion = (1u << 16),
45     eThreadIndexCompletion = (1u << 17),
46     eWatchPointIDCompletion = (1u << 18),
47     eBreakpointNameCompletion = (1u << 19),
48     eProcessIDCompletion = (1u << 20),
49     eProcessNameCompletion = (1u << 21),
50     eRemoteDiskFileCompletion = (1u << 22),
51     eRemoteDiskDirectoryCompletion = (1u << 23),
52     eTypeCategoryNameCompletion = (1u << 24),
53     // This item serves two purposes.  It is the last element in the enum, so
54     // you can add custom enums starting from here in your Option class. Also
55     // if you & in this bit the base code will not process the option.
56     eCustomCompletion = (1u << 24)
57   };
58 
59   static bool InvokeCommonCompletionCallbacks(
60       CommandInterpreter &interpreter, uint32_t completion_mask,
61       lldb_private::CompletionRequest &request, SearchFilter *searcher);
62 
63   // These are the generic completer functions:
64   static void DiskFiles(CommandInterpreter &interpreter,
65                         CompletionRequest &request, SearchFilter *searcher);
66 
67   static void DiskFiles(const llvm::Twine &partial_file_name,
68                         StringList &matches, TildeExpressionResolver &Resolver);
69 
70   static void DiskDirectories(CommandInterpreter &interpreter,
71                               CompletionRequest &request,
72                               SearchFilter *searcher);
73 
74   static void DiskDirectories(const llvm::Twine &partial_file_name,
75                               StringList &matches,
76                               TildeExpressionResolver &Resolver);
77 
78   static void RemoteDiskFiles(CommandInterpreter &interpreter,
79                               CompletionRequest &request,
80                               SearchFilter *searcher);
81 
82   static void RemoteDiskDirectories(CommandInterpreter &interpreter,
83                                     CompletionRequest &request,
84                                     SearchFilter *searcher);
85 
86   static void SourceFiles(CommandInterpreter &interpreter,
87                           CompletionRequest &request, SearchFilter *searcher);
88 
89   static void Modules(CommandInterpreter &interpreter,
90                       CompletionRequest &request, SearchFilter *searcher);
91 
92   static void ModuleUUIDs(CommandInterpreter &interpreter,
93                           CompletionRequest &request, SearchFilter *searcher);
94 
95   static void Symbols(CommandInterpreter &interpreter,
96                       CompletionRequest &request, SearchFilter *searcher);
97 
98   static void SettingsNames(CommandInterpreter &interpreter,
99                             CompletionRequest &request, SearchFilter *searcher);
100 
101   static void PlatformPluginNames(CommandInterpreter &interpreter,
102                                   CompletionRequest &request,
103                                   SearchFilter *searcher);
104 
105   static void ArchitectureNames(CommandInterpreter &interpreter,
106                                 CompletionRequest &request,
107                                 SearchFilter *searcher);
108 
109   static void VariablePath(CommandInterpreter &interpreter,
110                            CompletionRequest &request, SearchFilter *searcher);
111 
112   static void Registers(CommandInterpreter &interpreter,
113                         CompletionRequest &request, SearchFilter *searcher);
114 
115   static void Breakpoints(CommandInterpreter &interpreter,
116                           CompletionRequest &request, SearchFilter *searcher);
117 
118   static void BreakpointNames(CommandInterpreter &interpreter,
119                               CompletionRequest &request,
120                               SearchFilter *searcher);
121 
122   static void ProcessPluginNames(CommandInterpreter &interpreter,
123                                  CompletionRequest &request,
124                                  SearchFilter *searcher);
125 
126   static void ProcessIDs(CommandInterpreter &interpreter,
127                          CompletionRequest &request, SearchFilter *searcher);
128 
129   static void ProcessNames(CommandInterpreter &interpreter,
130                            CompletionRequest &request, SearchFilter *searcher);
131 
132   static void DisassemblyFlavors(CommandInterpreter &interpreter,
133                                  CompletionRequest &request,
134                                  SearchFilter *searcher);
135 
136   static void TypeLanguages(CommandInterpreter &interpreter,
137                             CompletionRequest &request, SearchFilter *searcher);
138 
139   static void FrameIndexes(CommandInterpreter &interpreter,
140                            CompletionRequest &request, SearchFilter *searcher);
141 
142   static void StopHookIDs(CommandInterpreter &interpreter,
143                           CompletionRequest &request, SearchFilter *searcher);
144 
145   static void ThreadIndexes(CommandInterpreter &interpreter,
146                             CompletionRequest &request, SearchFilter *searcher);
147 
148   static void WatchPointIDs(CommandInterpreter &interpreter,
149                             CompletionRequest &request, SearchFilter *searcher);
150 
151   static void TypeCategoryNames(CommandInterpreter &interpreter,
152                                 CompletionRequest &request,
153                                 SearchFilter *searcher);
154 };
155 
156 } // namespace lldb_private
157 
158 #endif // LLDB_INTERPRETER_COMMANDCOMPLETIONS_H
159