X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsymtab.c;h=567195304f40f9c40471ed09c35054814bad52af;hb=b4987c956dfa44ca9fd8552f63e15f5fa094b2a4;hp=146dc2e42134e94c2c88f0330983ea19524bfcc0;hpb=de63c46b549d1cf4f7851e47872cb759a12983f4;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symtab.c b/gdb/symtab.c index 146dc2e421..567195304f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -66,6 +66,7 @@ #include "filename-seen-cache.h" #include "arch-utils.h" #include +#include "common/pathstuff.h" /* Forward declarations for local functions. */ @@ -955,8 +956,7 @@ symbol_matches_search_name (const struct general_symbol_info *gsymbol, const lookup_name_info &name) { symbol_name_matcher_ftype *name_match - = language_get_symbol_name_matcher (language_def (gsymbol->language), - name); + = get_symbol_name_matcher (language_def (gsymbol->language), name); return name_match (symbol_search_name (gsymbol), name, NULL); } @@ -4704,24 +4704,10 @@ compare_symbol_name (const char *symbol_name, language symbol_language, const lookup_name_info &lookup_name, completion_match_result &match_res) { - const language_defn *lang; - - /* If we're completing for an expression and the symbol doesn't have - an explicit language set, fallback to the current language. Ada - minimal symbols won't have their language set to Ada, for - example, and if we compared using the default/C-like matcher, - then when completing e.g., symbols in a package named "pck", we'd - match internal Ada symbols like "pckS", which are invalid in an - Ada expression, unless you wrap them in '<' '>' to request a - verbatim match. */ - if (symbol_language == language_auto - && lookup_name.match_type () == symbol_name_match_type::EXPRESSION) - lang = current_language; - else - lang = language_def (symbol_language); + const language_defn *lang = language_def (symbol_language); symbol_name_matcher_ftype *name_match - = language_get_symbol_name_matcher (lang, lookup_name); + = get_symbol_name_matcher (lang, lookup_name); return name_match (symbol_name, lookup_name, &match_res); } @@ -5169,7 +5155,7 @@ default_collect_symbol_completion_matches_break_on if (current_language->la_macro_expansion == macro_expansion_c && code == TYPE_CODE_UNDEF) { - struct macro_scope *scope; + gdb::unique_xmalloc_ptr scope; /* This adds a macro's name to the current completion list. */ auto add_macro_name = [&] (const char *macro_name, @@ -5190,11 +5176,8 @@ default_collect_symbol_completion_matches_break_on completion time. */ scope = default_macro_scope (); if (scope) - { - macro_for_each_in_scope (scope->file, scope->line, - add_macro_name); - xfree (scope); - } + macro_for_each_in_scope (scope->file, scope->line, + add_macro_name); /* User-defined macros are always visible. */ macro_for_each (macro_user_macros, add_macro_name);