public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-modules] Use VAR_OR_FUNCTION_DECL_P
@ 2020-09-14 19:04 Nathan Sidwell
0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-09-14 19:04 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ec1fefe04360ae22ee1d84f549c92086d801a943
commit ec1fefe04360ae22ee1d84f549c92086d801a943
Author: Nathan Sidwell <nathan@acm.org>
Date: Mon Sep 14 10:34:45 2020 -0700
Use VAR_OR_FUNCTION_DECL_P
gcc/cp/
* pt.c (primary_template_specialization_p): Use
VAR_OR_FUNCTION_DECL_P.
(push_template_decl_real): Likewise.
* module.cc (trees_out::chained_decls): Use
VAR_OR_FUNCTION_DECL_P.
(trees_out::get_merge_kind, trees_in::is_matching_decl)
(depset::hash::make_dependency, depset::hash::add_binding_entity)
(specialization_add): Likewise.
Diff:
---
ChangeLog.modules | 10 ++++++++++
gcc/cp/module.cc | 18 +++++++-----------
gcc/cp/pt.c | 8 +++-----
3 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/ChangeLog.modules b/ChangeLog.modules
index db6e5640ab6..fa842db0607 100644
--- a/ChangeLog.modules
+++ b/ChangeLog.modules
@@ -1,5 +1,15 @@
2020-09-14 Nathan Sidwell <nathan@acm.org>
+ gcc/cp/
+ * pt.c (primary_template_specialization_p): Use
+ VAR_OR_FUNCTION_DECL_P.
+ (push_template_decl_real): Likewise.
+ * module.cc (trees_out::chained_decls): Use
+ VAR_OR_FUNCTION_DECL_P.
+ (trees_out::get_merge_kind, trees_in::is_matching_decl)
+ (depset::hash::make_dependency, depset::hash::add_binding_entity)
+ (specialization_add): Likewise.
+
Merge trunk d106029c2aa
Merge trunk 10f51543bb8
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index cc529220026..6161d6cc767 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -4853,8 +4853,7 @@ trees_out::chained_decls (tree decls)
{
for (; decls; decls = DECL_CHAIN (decls))
{
- if ((TREE_CODE (decls) == VAR_DECL
- || TREE_CODE (decls) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (decls)
&& DECL_LOCAL_DECL_P (decls))
{
/* Make sure this is the first encounter, and mark for
@@ -9860,8 +9859,7 @@ trees_out::get_merge_kind (tree decl, depset *dep)
{
if (!dep)
{
- if ((TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (decl)
&& DECL_LOCAL_DECL_P (decl))
return MK_unique;
@@ -9887,6 +9885,7 @@ trees_out::get_merge_kind (tree decl, depset *dep)
&& TREE_CODE (DECL_TI_TEMPLATE (decl)) != TEMPLATE_DECL)
/* A template specialization friend, we can treat as-if
unique. */
+ // FIXME: Isn't this now MK_friend_spec?
return MK_unique;
gcc_checking_assert (TYPE_P (ctx));
@@ -10898,8 +10897,7 @@ trees_in::is_matching_decl (tree existing, tree decl)
// that works right.
}
- if ((TREE_CODE (decl) == VAR_DECL
- || TREE_CODE (decl) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (decl)
&& DECL_TEMPLATE_INSTANTIATED (decl))
/* Don't instantiate again! */
DECL_TEMPLATE_INSTANTIATED (existing) = true;
@@ -12195,8 +12193,7 @@ depset::hash::make_dependency (tree decl, entity_kind ek)
if (!TREE_PUBLIC (ctx))
/* Member of internal namespace. */
dep->set_flag_bit<DB_IS_INTERNAL_BIT> ();
- else if ((TREE_CODE (not_tmpl) == FUNCTION_DECL
- || TREE_CODE (not_tmpl) == VAR_DECL)
+ else if (VAR_OR_FUNCTION_DECL_P (not_tmpl)
&& DECL_THIS_STATIC (not_tmpl))
{
/* An internal decl. In global module permit
@@ -12343,8 +12340,7 @@ depset::hash::add_binding_entity (tree decl, bool maybe_dups,
/* Ignore global module fragment entities. */
return false;
- if ((TREE_CODE (inner) == VAR_DECL
- || TREE_CODE (inner) == FUNCTION_DECL)
+ if (VAR_OR_FUNCTION_DECL_P (inner)
&& DECL_THIS_STATIC (inner))
{
if (!header_module_p ())
@@ -12530,7 +12526,7 @@ specialization_add (bool decl_p, spec_entry *entry, void *data_)
gcc_checking_assert (!check_mergeable_specialization (true, entry)
== (decl_p || !DECL_ALIAS_TEMPLATE_P (entry->tmpl)));
}
- else if (VAR_P (entry->spec) || TREE_CODE (entry->spec) == FUNCTION_DECL)
+ else if (VAR_OR_FUNCTION_DECL_P (entry->spec))
gcc_checking_assert (!DECL_LOCAL_DECL_P (entry->spec));
data->safe_push (entry);
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 68046bd50a8..99ac55897c4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3632,7 +3632,7 @@ primary_template_specialization_p (const_tree t)
if (!t)
return false;
- if (TREE_CODE (t) == FUNCTION_DECL || VAR_P (t))
+ if (VAR_OR_FUNCTION_DECL_P (t))
return (DECL_LANG_SPECIFIC (t)
&& DECL_USE_TEMPLATE (t)
&& DECL_TEMPLATE_INFO (t)
@@ -6095,10 +6095,8 @@ push_template_decl_real (tree decl, bool is_friend)
if (is_primary)
retrofit_lang_decl (decl);
if (DECL_LANG_SPECIFIC (decl)
- && ((TREE_CODE (decl) != VAR_DECL
- && TREE_CODE (decl) != FUNCTION_DECL)
- || !ctx
- || !DECL_LOCAL_DECL_P (decl)))
+ && !(VAR_OR_FUNCTION_DECL_P (decl)
+ && DECL_LOCAL_DECL_P (decl)))
DECL_TEMPLATE_INFO (decl) = info;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-14 19:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 19:04 [gcc/devel/c++-modules] Use VAR_OR_FUNCTION_DECL_P Nathan Sidwell
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).