Re: [PATCH 33/40] Make the linespec/location completer ignore data symbols

Pedro Alves
2017-11-08T16:22:42Z

On 08/09/2017 04:42 PM, Keith Seitz wrote:
> On 06/02/2017 05:22 AM, Pedro Alves wrote:
>>
>> diff --git a/gdb/symtab.c b/gdb/symtab.c
>> index bbc317d..52cf70a 100644
>> --- a/gdb/symtab.c
>> +++ b/gdb/symtab.c
>> @@ -5034,11 +5034,44 @@ completion_list_add_fields (completion_tracker &tracker,
>> }
>> }
>>
>> +/* See symtab.h. */
>> +
>> +bool
>> +symbol_is_function_or_method (symbol *sym)
>> +{
>> + switch (TYPE_CODE (SYMBOL_TYPE (sym)))
>> + {
>> + case TYPE_CODE_FUNC:
>> + case TYPE_CODE_METHOD:
>> + return true;
>> + default:
>> + return false;
>> + }
>> +}
>> +
>> +/* Return whether MSYMBOL is a function/method. */
>> +
>
> I think "See symtab.h." is more customary here?

Indeed, fixed.

>
>> +bool
>> +symbol_is_function_or_method (minimal_symbol *msymbol)
>> +{
>> + switch (MSYMBOL_TYPE (msymbol))
>> + {
>> + case mst_text:
>> + case mst_text_gnu_ifunc:
>> + case mst_solib_trampoline:
>> + case mst_file_text:
>> + return true;
>> + default:
>> + return false;
>> + }
>> +}
>> +
>> /* Add matching symbols from SYMTAB to the current completion list. */
>>
>> static void
>> add_symtab_completions (struct compunit_symtab *cust,
>> completion_tracker &tracker,
>> + complete_symbol_mode mode,
>> const lookup_name_info &lookup_name,
>> const char *text, const char *word,
>> enum type_code code)
>
> Otherwise, LGTM.

I pushed this one in too, even though I haven't pushed patches
#31 nor #32 yet. (Because I haven't yet addressed your reviews).
(I don't really recall why I originally ordered this one after.
There seems to be no good reason.)

Thanks,
Pedro Alves