]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
symtab.c: Small refactor
authorPedro Alves <palves@redhat.com>
Fri, 24 Feb 2017 17:42:51 +0000 (17:42 +0000)
committerPedro Alves <palves@redhat.com>
Fri, 24 Feb 2017 17:42:51 +0000 (17:42 +0000)
add_symtab_completions does the exact same as the code that it is
replacing.

gdb/ChangeLog:
2017-02-24  Pedro Alves  <palves@redhat.com>

* symtab.c (make_file_symbol_completion_list_1): Use
add_symtab_completions.

gdb/ChangeLog
gdb/symtab.c

index ed9fc6a707d965c9a83629796514cfb804fb3223..ed697b372c8ab8bc150b2647a40f63ee9a018d4a 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-24  Pedro Alves  <palves@redhat.com>
+
+       * symtab.c (make_file_symbol_completion_list_1): Use
+       add_symtab_completions.
+
 2017-02-24  Alan Hayward  <alan.hayward@arm.com>
 
        * stack.c (frame_info): Use frame_unwind_register_value to avoid buf.
index b9f4f7747ad53227d14b7ce335d81122c4aa7aad..c0fd0fd4d5b2143be71a443e94577acd808c7fce 100644 (file)
@@ -5391,10 +5391,7 @@ static VEC (char_ptr) *
 make_file_symbol_completion_list_1 (const char *text, const char *word,
                                    const char *srcfile)
 {
-  struct symbol *sym;
   struct symtab *s;
-  struct block *b;
-  struct block_iterator iter;
   /* The symbol we are completing on.  Points in same buffer as text.  */
   const char *sym_text;
   /* Length of sym_text.  */
@@ -5464,18 +5461,9 @@ make_file_symbol_completion_list_1 (const char *text, const char *word,
 
   /* Go through this symtab and check the externs and statics for
      symbols which match.  */
-
-  b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
-  ALL_BLOCK_SYMBOLS (b, iter, sym)
-    {
-      COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
-    }
-
-  b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
-  ALL_BLOCK_SYMBOLS (b, iter, sym)
-    {
-      COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
-    }
+  add_symtab_completions (SYMTAB_COMPUNIT (s),
+                         sym_text, sym_text_len,
+                         text, word, TYPE_CODE_UNDEF);
 
   return (return_val);
 }