X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fcompleter.c;h=d3900ae201443ab0a5510816e9c5589ef36b9f5b;hb=e05523bd2411bac0277da73556f4d01f6c7448aa;hp=060160f17faed5028386978fed6fc597e34841a6;hpb=ef5f598ca6483ff965047df7f7e8697a70860527;p=binutils-gdb.git diff --git a/gdb/completer.c b/gdb/completer.c index 060160f17fa..d3900ae2014 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -1,5 +1,5 @@ /* Line completion stuff for GDB, the GNU debugger. - Copyright (C) 2000-2021 Free Software Foundation, Inc. + Copyright (C) 2000-2022 Free Software Foundation, Inc. This file is part of GDB. @@ -250,14 +250,6 @@ filename_completer_handle_brkchars (struct cmd_list_element *ignore, (gdb_completer_file_name_break_characters); } -/* Possible values for the found_quote flags word used by the completion - functions. It says what kind of (shell-like) quoting we found anywhere - in the line. */ -#define RL_QF_SINGLE_QUOTE 0x01 -#define RL_QF_DOUBLE_QUOTE 0x02 -#define RL_QF_BACKSLASH 0x04 -#define RL_QF_OTHER_QUOTE 0x08 - /* Find the bounds of the current word for completion purposes, and return a pointer to the end of the word. This mimics (and is a modified version of) readline's _rl_find_completion_word internal @@ -284,7 +276,7 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, int *qc, int *dp, const char *line_buffer) { - int scan, end, found_quote, delimiter, pass_next, isbrk; + int scan, end, delimiter, pass_next, isbrk; char quote_char; const char *brkchars; int point = strlen (line_buffer); @@ -301,7 +293,7 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, } end = point; - found_quote = delimiter = 0; + delimiter = 0; quote_char = '\0'; brkchars = info->word_break_characters; @@ -311,8 +303,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, /* We have a list of characters which can be used in pairs to quote substrings for the completer. Try to find the start of an unclosed quoted substring. */ - /* FOUND_QUOTE is set so we know what kind of quotes we - found. */ for (scan = pass_next = 0; scan < end; scan++) @@ -330,7 +320,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, if (quote_char != '\'' && line_buffer[scan] == '\\') { pass_next = 1; - found_quote |= RL_QF_BACKSLASH; continue; } @@ -351,13 +340,6 @@ gdb_rl_find_completion_word (struct gdb_rl_completion_word_info *info, /* Found start of a quoted substring. */ quote_char = line_buffer[scan]; point = scan + 1; - /* Shell-like quoting conventions. */ - if (quote_char == '\'') - found_quote |= RL_QF_SINGLE_QUOTE; - else if (quote_char == '"') - found_quote |= RL_QF_DOUBLE_QUOTE; - else - found_quote |= RL_QF_OTHER_QUOTE; } } } @@ -1091,13 +1073,13 @@ add_struct_fields (struct type *type, completion_list &output, if (i < TYPE_N_BASECLASSES (type)) add_struct_fields (TYPE_BASECLASS (type, i), output, fieldname, namelen); - else if (TYPE_FIELD_NAME (type, i)) + else if (type->field (i).name ()) { - if (TYPE_FIELD_NAME (type, i)[0] != '\0') + if (type->field (i).name ()[0] != '\0') { - if (! strncmp (TYPE_FIELD_NAME (type, i), + if (! strncmp (type->field (i).name (), fieldname, namelen)) - output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i))); + output.emplace_back (xstrdup (type->field (i).name ())); } else if (type->field (i).type ()->code () == TYPE_CODE_UNION) { @@ -1152,7 +1134,7 @@ complete_expression (completion_tracker &tracker, for (;;) { type = check_typedef (type); - if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type)) + if (!type->is_pointer_or_reference ()) break; type = TYPE_TARGET_TYPE (type); }