- created a common completion for breakpoint names;
- bound the breakpoint name common completion with eArgTypeBreakpointName;
- implemented the dedicated completion for breakpoint read -N.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Maybe I'm missing something, but this seems to be two very different independent patches in one (one for br read completion and one for br set which don't depend on each other)? If yes, then please split these up in the future. It's usually less work to review smaller patches (and it's just good practice to do so).
Just some minor points, beside that this LGTM.
@JDevlieghere Can you double check that the structured data use in this patch is fine?
lldb/source/Commands/CommandCompletions.cpp | ||
---|---|---|
631 | Some small code style adjustments here: for (const std::string &name : name_list) request.TryCompleteCurrentArg(name); (no curly braces around the single statement body and using a reference because that's how LLVM is usually doing this). | |
lldb/source/Commands/CommandObjectBreakpoint.cpp | ||
2115 | Could you make this just an llvm::Optional<FileSpec> file_spec and then set that in the loop. Then you can drop the success variable. | |
2163 | If you drop success than this can just be if (!bkpt_dict->GetValueForKeyAsArray("Names", names_array)) | |
lldb/test/API/functionalities/completion/TestCompletion.py | ||
654 | Do we need the os.getcwd() here? This should work without if I understand correctly (also it avoids the whole issue of spaces in the path breaking this command). | |
654 | There should also be a test for a invalid JSON file and one where the prefix couldn't be found (e.g., try completing "n" to nothing and "m" to "mm"). | |
660 | We just landed some improvements to this upstream, so this can now be self.assertSuccess(bp1.AddNameWithErrorHandling("nn")). |
- replaced std::string with const std::string& in for loop;
- refactored the success segment with llvm::Optional<FileSpec> file_spec;
- added invalidation check in test.
lldb/include/lldb/Interpreter/CommandCompletions.h | ||
---|---|---|
106 | Please clang-format the patch. | |
lldb/source/Commands/CommandObjectBreakpoint.cpp | ||
2100–2172 | While you're here you might as well remove this useless comment :-) | |
2116 | Please convert these to StringRef and use its comparison operator. | |
2126 | There's nothing wrong with using getValue() but the consensus across LLVM and LLDB is to use *file_spec. | |
lldb/test/API/functionalities/completion/breakpoints.json | ||
35 | As pointed out by phab. |
lldb/source/Commands/CommandObjectBreakpoint.cpp | ||
---|---|---|
2133 | The structured data looks good to me. I'm not convinced this is where that logic should live, but given the current implementation where all that stuff is implemented in the corresponding data structures, I think that's fine. |
- clang-formatted related files;
- refactored line 2100 with StringRef;
- replaced files_pec.hasValue() to file_spec, file_spec.getValue() to *file_spec;
- removed an useless comment;
- added a new line at the end of breakpoints.json.
Please clang-format the patch.