When LLDB sees only one possible completion for an input, it will add a trailing space to the completion to signal that to the user. If the current argument is quoted, that also means LLDB needs to add the trailing quote to finish the current argument first. In case the user is in a function with only one local variable and is currently editing an empty line in the multiline expression editor, then we are in the unique situation where we can have a unique completion for an empty input line. (In a normal LLDB session this would never occur as empty input would just list all the possible commands). In this special situation our check if the current argument needs to receive a trailing quote will crash LLDB as there is no current argument and the completion code just unconditionally tries to access the current argument. This just adds the missing check if we even have a current argument before we check if we need to add a terminating quote character. Reviewed By: labath Differential Revision: https://reviews.llvm.org/D85903
12 lines
296 B
C
12 lines
296 B
C
int single_local_func() {
|
|
// This function should always only have a single local variable and no
|
|
// parameters.
|
|
int only_local = 3;
|
|
return only_local; // break in single_local_func
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
int to_complete = 0;
|
|
return to_complete + single_local_func();
|
|
}
|