From: Nathan Sidwell <nathan@acm.org>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [C++ PATCH] maybe_add_lang_type_raw simplification
Date: Thu, 29 Jun 2017 14:47:00 -0000 [thread overview]
Message-ID: <e7244c34-416e-a185-b853-8a2e79bc46f6@acm.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 154 bytes --]
I found maybe_add_lang_type_raw benefitted from simply returning false
early, rather than use a bool flag.
applied to trunk.
nathan
--
Nathan Sidwell
[-- Attachment #2: lex.diff --]
[-- Type: text/x-patch, Size: 1204 bytes --]
2017-06-29 Nathan Sidwell <nathan@acm.org>
* lex.c (maybe_add_lang_type_raw): Exit early, rather than use a
flag.
Index: lex.c
===================================================================
--- lex.c (revision 249779)
+++ lex.c (working copy)
@@ -741,21 +741,21 @@ copy_type (tree type MEM_STAT_DECL)
static bool
maybe_add_lang_type_raw (tree t)
{
- bool add = (RECORD_OR_UNION_CODE_P (TREE_CODE (t))
- || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM);
- if (add)
- {
- TYPE_LANG_SPECIFIC (t)
- = (struct lang_type *) (ggc_internal_cleared_alloc
- (sizeof (struct lang_type)));
+ if (!(RECORD_OR_UNION_CODE_P (TREE_CODE (t))
+ || TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM))
+ return false;
+
+ TYPE_LANG_SPECIFIC (t)
+ = (struct lang_type *) (ggc_internal_cleared_alloc
+ (sizeof (struct lang_type)));
- if (GATHER_STATISTICS)
- {
- tree_node_counts[(int)lang_type] += 1;
- tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
- }
+ if (GATHER_STATISTICS)
+ {
+ tree_node_counts[(int)lang_type] += 1;
+ tree_node_sizes[(int)lang_type] += sizeof (struct lang_type);
}
- return add;
+
+ return true;
}
tree
reply other threads:[~2017-06-29 14:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e7244c34-416e-a185-b853-8a2e79bc46f6@acm.org \
--to=nathan@acm.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).