From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100991 invoked by alias); 23 May 2018 06:16:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 100150 invoked by uid 89); 23 May 2018 06:15:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=cu X-HELO: gateway20.websitewelcome.com Received: from gateway20.websitewelcome.com (HELO gateway20.websitewelcome.com) (192.185.64.36) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 May 2018 06:15:07 +0000 Received: from cm10.websitewelcome.com (cm10.websitewelcome.com [100.42.49.4]) by gateway20.websitewelcome.com (Postfix) with ESMTP id 7E446400C50C0 for ; Wed, 23 May 2018 01:15:06 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id LN3Cfx2iTBcCXLN3CfrTXg; Wed, 23 May 2018 01:15:06 -0500 X-Authority-Reason: nr=8 Received: from 174-29-44-154.hlrn.qwest.net ([174.29.44.154]:56108 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fLLrj-003S5D-Vc; Tue, 22 May 2018 23:59:12 -0500 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [RFA 39/42] Parameterize cp_scan_for_anonymous_namespaces Date: Wed, 23 May 2018 06:16:00 -0000 Message-Id: <20180523045851.11660-40-tom@tromey.com> In-Reply-To: <20180523045851.11660-1-tom@tromey.com> References: <20180523045851.11660-1-tom@tromey.com> X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fLLrj-003S5D-Vc X-Source-Sender: 174-29-44-154.hlrn.qwest.net (bapiya.Home) [174.29.44.154]:56108 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-05/txt/msg00612.txt.bz2 This changes cp_scan_for_anonymous_namespaces to use the buildsym_compunit API, rather than the function-based API. 2018-05-22 Tom Tromey * stabsread.c (define_symbol): Update. * legacy-buildsym.h (get_buildsym_compunit): Declare. * dwarf2read.c (new_symbol): Update. * cp-support.h (cp_scan_for_anonymous_namespaces): Update. * cp-namespace.c: Include buildsym.h. (cp_scan_for_anonymous_namespaces): Add "compunit" parameter. * buildsym.c (get_buildsym_compunit): New function. --- gdb/ChangeLog | 10 ++++++++++ gdb/buildsym.c | 7 +++++++ gdb/cp-namespace.c | 11 ++++++----- gdb/cp-support.h | 4 +++- gdb/dwarf2read.c | 3 ++- gdb/legacy-buildsym.h | 4 ++++ gdb/stabsread.c | 3 ++- 7 files changed, 34 insertions(+), 8 deletions(-) diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 3e3170f0ee..d9a0e02653 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1634,3 +1634,10 @@ record_line (struct subfile *subfile, int line, CORE_ADDR pc) gdb_assert (buildsym_compunit != nullptr); buildsym_compunit->record_line (subfile, line, pc); } + +struct buildsym_compunit * +get_buildsym_compunit () +{ + gdb_assert (buildsym_compunit != nullptr); + return buildsym_compunit; +} diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 41affca3a8..03f75ae486 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -29,7 +29,7 @@ #include "dictionary.h" #include "command.h" #include "frame.h" -#include "legacy-buildsym.h" +#include "buildsym.h" #include "language.h" #include "namespace.h" #include @@ -50,7 +50,8 @@ static struct type *cp_lookup_transparent_type_loop (const char *name, anonymous namespace; if so, add an appropriate using directive. */ void -cp_scan_for_anonymous_namespaces (const struct symbol *const symbol, +cp_scan_for_anonymous_namespaces (struct buildsym_compunit *compunit, + const struct symbol *const symbol, struct objfile *const objfile) { if (SYMBOL_DEMANGLED_NAME (symbol) != NULL) @@ -94,9 +95,9 @@ cp_scan_for_anonymous_namespaces (const struct symbol *const symbol, namespace given by the previous component if there is one, or to the global namespace if there isn't. */ std::vector excludes; - add_using_directive (get_local_using_directives (), - dest, src, NULL, NULL, excludes, 1, - &objfile->objfile_obstack); + add_using_directive (compunit->get_local_using_directives (), + dest, src, NULL, NULL, excludes, + 1, &objfile->objfile_obstack); } /* The "+ 2" is for the "::". */ previous_component = next_component + 2; diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 44725818e9..0739dcdf5f 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -33,6 +33,7 @@ struct symbol; struct block; +struct buildsym_compunit; struct objfile; struct type; struct demangle_component; @@ -132,7 +133,8 @@ extern symbol_name_matcher_ftype *cp_get_symbol_name_matcher extern int cp_is_in_anonymous (const char *symbol_name); -extern void cp_scan_for_anonymous_namespaces (const struct symbol *symbol, +extern void cp_scan_for_anonymous_namespaces (struct buildsym_compunit *, + const struct symbol *symbol, struct objfile *objfile); extern struct block_symbol cp_lookup_symbol_nonlocal diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 75a121073c..504e8e4e6c 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -21596,7 +21596,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, namespaces based on the demangled name. */ if (!cu->processing_has_namespace_info && cu->language == language_cplus) - cp_scan_for_anonymous_namespaces (sym, objfile); + cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym, + objfile); } return (sym); } diff --git a/gdb/legacy-buildsym.h b/gdb/legacy-buildsym.h index 66a3ea8cd0..5d405ee881 100644 --- a/gdb/legacy-buildsym.h +++ b/gdb/legacy-buildsym.h @@ -207,4 +207,8 @@ extern struct pending **get_file_symbols (); extern struct pending **get_global_symbols (); +/* Return the current buildsym_compunit. */ + +extern struct buildsym_compunit *get_buildsym_compunit (); + #endif /* defined (LEGACY_BUILDSYM_H) */ diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 62221d03cf..481948117b 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -755,7 +755,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type, SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile); if (SYMBOL_LANGUAGE (sym) == language_cplus) - cp_scan_for_anonymous_namespaces (sym, objfile); + cp_scan_for_anonymous_namespaces (get_buildsym_compunit (), sym, + objfile); } p++; -- 2.13.6