aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2020-10-07 05:02:34 -0700
committerNathan Sidwell <nathan@acm.org>2020-10-07 05:06:52 -0700
commit99e9b54313dbb8fdb3d2a354c9554478cc33e234 (patch)
tree951f89b82e5393a8fbdf3bd7e47ff961738e2811
parentba42c30445cef0aef15405d92361a536e12ae865 (diff)
downloadgcc-99e9b54313dbb8fdb3d2a354c9554478cc33e234.zip
gcc-99e9b54313dbb8fdb3d2a354c9554478cc33e234.tar.gz
gcc-99e9b54313dbb8fdb3d2a354c9554478cc33e234.tar.bz2
c++: Rename DECL_BUILTIN_P to DECL_UNDECLARED_BUILTIN_P
I realized I'd misnamed DECL_BUILTIN_P, it's only true of compiler builtins unless and until the user declares them -- at that point they're real decls, and will have a location in the user's source. (BUILT_IN_FN and friends still work though). This renames them so future-me is not confused as to why the predicate becomes false. gcc/cp/ * cp-tree.h (DECL_BUILTIN_P): Rename to ... (DECL_UNDECLARED_BUILTIN_P): ... here. * decl.c (duplicate_decls): Adjust. * name-lookup.c (anticipated_builtin_p): Adjust. (do_nonmember_using_decl): Likewise. libcc1/ * libcp1plugin.cc (supplement_binding): Rename DECL_BUILTIN_P.
-rw-r--r--gcc/cp/cp-tree.h5
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/name-lookup.c4
-rw-r--r--libcc1/libcp1plugin.cc2
4 files changed, 7 insertions, 6 deletions
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index c7b5e791..e5a2ff2 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4035,8 +4035,9 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
#define FNDECL_USED_AUTO(NODE) \
TREE_LANG_FLAG_2 (FUNCTION_DECL_CHECK (NODE))
-/* True if NODE is a builtin decl. */
-#define DECL_BUILTIN_P(NODE) \
+/* True if NODE is an undeclared builtin decl. As soon as the user
+ declares it, the location will be updated. */
+#define DECL_UNDECLARED_BUILTIN_P(NODE) \
(DECL_SOURCE_LOCATION(NODE) == BUILTINS_LOCATION)
/* True for artificial decls added for OpenMP privatized non-static
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f333a36..4ec1f4a 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1467,7 +1467,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
/* Check for redeclaration and other discrepancies. */
if (TREE_CODE (olddecl) == FUNCTION_DECL
- && DECL_BUILTIN_P (olddecl))
+ && DECL_UNDECLARED_BUILTIN_P (olddecl))
{
if (TREE_CODE (newdecl) != FUNCTION_DECL)
{
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 774c447..ea0bfdc 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2129,7 +2129,7 @@ anticipated_builtin_p (tree ovl)
{
return (TREE_CODE (ovl) == OVERLOAD
&& OVL_HIDDEN_P (ovl)
- && DECL_BUILTIN_P (OVL_FUNCTION (ovl)));
+ && DECL_UNDECLARED_BUILTIN_P (OVL_FUNCTION (ovl)));
}
/* BINDING records an existing declaration for a name in the current scope.
@@ -3982,7 +3982,7 @@ do_nonmember_using_decl (name_lookup &lookup, bool fn_scope_p,
}
else if (old.using_p ())
continue; /* This is a using decl. */
- else if (old.hidden_p () && DECL_BUILTIN_P (old_fn))
+ else if (old.hidden_p () && DECL_UNDECLARED_BUILTIN_P (old_fn))
continue; /* This is an anticipated builtin. */
else if (!matching_fn_p (new_fn, old_fn))
continue; /* Parameters do not match. */
diff --git a/libcc1/libcp1plugin.cc b/libcc1/libcp1plugin.cc
index 9817425..e7ab325 100644
--- a/libcc1/libcp1plugin.cc
+++ b/libcc1/libcp1plugin.cc
@@ -353,7 +353,7 @@ supplement_binding (cxx_binding *binding, tree decl)
/* If TARGET_BVAL is anticipated but has not yet been
declared, pretend it is not there at all. */
|| (TREE_CODE (target_bval) == FUNCTION_DECL
- && DECL_BUILTIN_P (target_bval)))
+ && DECL_UNDECLARED_BUILTIN_P (target_bval)))
binding->value = decl;
else if (TREE_CODE (target_bval) == TYPE_DECL
&& DECL_ARTIFICIAL (target_bval)