From patchwork Fri Feb 13 20:05:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 5069 Received: (qmail 5170 invoked by alias); 13 Feb 2015 20:05:45 -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 5151 invoked by uid 89); 13 Feb 2015 20:05:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pd0-f201.google.com Received: from mail-pd0-f201.google.com (HELO mail-pd0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 13 Feb 2015 20:05:44 +0000 Received: by pdbfl12 with SMTP id fl12so6785983pdb.0 for ; Fri, 13 Feb 2015 12:05:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=5c0JLdrDJQRhCuKD2u8zIH6gpsKxFxbvLzYQik9dITs=; b=an/EaYcZuD1EZTSQpFrPp/LpZzbq44WRMgkpsuezEANke9vLssxuxAU7kcpeOG54JQ m5tnkkR6/MnoPhJD1jt1cn/hS2RkzaEi4g1Ay2KXpbre9N2Z2RB37Lp1dCPQEaGqSXvD 2YZDycgIB8eihoVOYWKUXU4UzBiGJCpRYPUxnrGA8ZkSgWQKSF5kMgPW8tiRxV+pvxnF hrcvOtndow/iIFq4xq3Yu40kiJLzuZYIVvJqiYn06gHxmtbH8+cC9CaciDoSINZGP1gO 7tX/nXp+tYUi45uQdoW+Ohl4Kfoo+H3xI95eHHa98lEv2KEOyNTH54v8veu8esQGYinn cbQg== X-Gm-Message-State: ALoCoQnhs0kSZNJfrgXDyk9nE1VV7Qp6ghj+qFCE3iDFHTRze/Bi2+ylokwap24wEGr8ldDKnZ6mC/OyUYXAwqIhrvRcZsOFlu//UCplyTgEAkmuJEAtfJqlSDcLN3+FLA/121U8bpn9FT/n4iFkPU3yjd6rO4a5BhspOoIAMy1Be94CqmXXf4I= X-Received: by 10.66.190.229 with SMTP id gt5mr10054268pac.27.1423857942432; Fri, 13 Feb 2015 12:05:42 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id h75si300498yhd.2.2015.02.13.12.05.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Feb 2015 12:05:42 -0800 (PST) Received: from ruffy.mtv.corp.google.com ([172.17.128.44]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTPS id Bm5qPDBk.1; Fri, 13 Feb 2015 12:05:42 -0800 From: Doug Evans To: gdb-patches@sourceware.org Subject: [COMMITTED PATCH] misc cp-namespace.c cleanups Date: Fri, 13 Feb 2015 12:05:41 -0800 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. While working on a few bugs I ran across a few cleanups. Just comments and variable names, no code changes. 2015-02-13 Doug Evans * cp-namespace.c (cp_basic_lookup_symbol): Rename parameter anonymous_namespace to is_in_anonymous for consistency with the rest of the file. (cp_lookup_bare_symbol): Fix typo in comment. (cp_search_static_and_baseclasses): Ditto. (search_symbol_list): Use vertical space in comment better. (reset_directive_searched): Ditto. Fix typo. (cp_lookup_nested_symbol_1): Clarify contents of NESTED_NAME parameter. diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index 4bec821..2cc2ea9 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -209,12 +209,12 @@ cp_is_in_anonymous (const char *symbol_name) } /* Look up NAME in DOMAIN in BLOCK's static block and in global blocks. - If ANONYMOUS_NAMESPACE is nonzero, the symbol in question is located + If IS_IN_ANONYMOUS is nonzero, the symbol in question is located within an anonymous namespace. */ static struct symbol * cp_basic_lookup_symbol (const char *name, const struct block *block, - const domain_enum domain, int anonymous_namespace) + const domain_enum domain, int is_in_anonymous) { struct symbol *sym; @@ -222,7 +222,7 @@ cp_basic_lookup_symbol (const char *name, const struct block *block, if (sym != NULL) return sym; - if (anonymous_namespace) + if (is_in_anonymous) { /* Symbols defined in anonymous namespaces have external linkage but should be treated as local to a single file nonetheless. @@ -307,7 +307,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef, if (TYPE_NAME (type) == NULL) return NULL; - /* Look for a symbol named NESTED in this class. */ + /* Look for symbol NAME in this class. */ sym = cp_lookup_nested_symbol (type, name, block); } @@ -317,7 +317,7 @@ cp_lookup_bare_symbol (const struct language_defn *langdef, /* Search NAME in DOMAIN in all static blocks, and then in all baseclasses. BLOCK specifies the context in which to perform the search. NAME is guaranteed to have scope (contain "::") and PREFIX_LEN specifies - then length the entire scope of NAME (up to, but not including, the last + the length of the entire scope of NAME (up to, but not including, the last "::". Note: At least in the case of Fortran, which also uses this code, there @@ -421,8 +421,7 @@ cp_lookup_symbol_in_namespace (const char *namespace, const char *name, return sym; } -/* Used for cleanups to reset the "searched" flag incase - of an error. */ +/* Used for cleanups to reset the "searched" flag in case of an error. */ static void reset_directive_searched (void *data) @@ -577,8 +576,7 @@ cp_lookup_symbol_via_imports (const char *scope, return NULL; } -/* Helper function that searches an array of symbols for one named - NAME. */ +/* Helper function that searches an array of symbols for one named NAME. */ static struct symbol * search_symbol_list (const char *name, int num, @@ -938,6 +936,7 @@ find_symbol_in_baseclass (struct type *parent_type, const char *name, /* Helper function to look up NESTED_NAME in CONTAINER_TYPE within the context of BLOCK. + NESTED_NAME may have scope ("::"). CONTAINER_TYPE needn't have been "check_typedef'd" yet. CONCATENATED_NAME is the fully scoped spelling of NESTED_NAME, it is passed as an argument so that callers can control how space for it is