From patchwork Sat Dec 13 19:18:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 4237 Received: (qmail 9269 invoked by alias); 13 Dec 2014 19:19:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 9256 invoked by uid 89); 13 Dec 2014 19:19:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pa0-f53.google.com Received: from mail-pa0-f53.google.com (HELO mail-pa0-f53.google.com) (209.85.220.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sat, 13 Dec 2014 19:19:01 +0000 Received: by mail-pa0-f53.google.com with SMTP id kq14so9121346pab.26 for ; Sat, 13 Dec 2014 11:19:00 -0800 (PST) X-Received: by 10.70.2.65 with SMTP id 1mr37753301pds.13.1418498340177; Sat, 13 Dec 2014 11:19:00 -0800 (PST) Received: from sspiff.org (173-13-178-50-sfba.hfc.comcastbusiness.net. [173.13.178.50]) by mx.google.com with ESMTPSA id b9sm4835910pbu.95.2014.12.13.11.18.57 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Dec 2014 11:18:59 -0800 (PST) Received: by sspiff.org (sSMTP sendmail emulation); Sat, 13 Dec 2014 11:18:06 -0800 From: Doug Evans To: gdb-patches@sourceware.org Subject: [PATCH] Rename cp_lookup_symbol_imports to cp_lookup_symbol_via_imports Date: Sat, 13 Dec 2014 11:18:06 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. Maybe it's just me, but I find cp-namespace.c to be unreadable in that I have to keep too much state in my head about what functions REALLY do because their names are ambiguous and confusing. In this case, this rename makes this part 10x easier for me to read. I don't have to remember what "lookup symbol imports" REALLY means (it doesn't mean anything, it's "lookup symbol VIA imports"). Also, cp_lookup_symbol_imports currently does this: /* First, try to find the symbol in the given namespace. */ if (!declaration_only) sym = cp_lookup_symbol_in_namespace (scope, name, block, domain, 1); That's not really in keeping with what the function is intended to do, but moving that out is a topic for another patch. 2014-12-13 Doug Evans * cp-namespace.c (cp_lookup_symbol_via_imports): Renamed from cp_lookup_symbol_imports. All callers updated. diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 3066737..06290a7 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -371,12 +371,12 @@ reset_directive_searched (void *data) only the import of Y is considered. */ static struct symbol * -cp_lookup_symbol_imports (const char *scope, - const char *name, - const struct block *block, - const domain_enum domain, - const int declaration_only, - const int search_parents) +cp_lookup_symbol_via_imports (const char *scope, + const char *name, + const struct block *block, + const domain_enum domain, + const int declaration_only, + const int search_parents) { struct using_direct *current; struct symbol *sym = NULL; @@ -472,9 +472,9 @@ cp_lookup_symbol_imports (const char *scope, /* If this import statement creates no alias, pass current->inner as NAMESPACE to direct the search towards the imported namespace. */ - sym = cp_lookup_symbol_imports (current->import_src, - name, block, - domain, 0, 0); + sym = cp_lookup_symbol_via_imports (current->import_src, + name, block, + domain, 0, 0); } current->searched = 0; discard_cleanups (searched_cleanup); @@ -505,7 +505,7 @@ search_symbol_list (const char *name, int num, return NULL; } -/* Like cp_lookup_symbol_imports, but if BLOCK is a function, it +/* Like cp_lookup_symbol_via_imports, but if BLOCK is a function, it searches through the template parameters of the function and the function's type. */ @@ -578,7 +578,7 @@ cp_lookup_symbol_imports_or_template (const char *scope, } } - return cp_lookup_symbol_imports (scope, name, block, domain, 1, 1); + return cp_lookup_symbol_via_imports (scope, name, block, domain, 1, 1); } /* Searches for NAME in the current namespace, and by applying @@ -604,8 +604,8 @@ cp_lookup_symbol_namespace (const char *scope, blocks. */ while (block != NULL) { - sym = cp_lookup_symbol_imports (scope, name, block, - domain, 0, 1); + sym = cp_lookup_symbol_via_imports (scope, name, block, + domain, 0, 1); if (sym) return sym;