aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/rtti.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2017-05-05 20:04:45 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-05-05 20:04:45 +0000
commit4b4b2e58e318f491bfc8d939129b6d6fbfa650f9 (patch)
tree002453e2ee6e27c37bcedfa7b53ecacfcf61ee37 /gcc/cp/rtti.c
parent359b060e79c2fc423b733229205a9cfbcd634a0a (diff)
downloadgcc-4b4b2e58e318f491bfc8d939129b6d6fbfa650f9.zip
gcc-4b4b2e58e318f491bfc8d939129b6d6fbfa650f9.tar.gz
gcc-4b4b2e58e318f491bfc8d939129b6d6fbfa650f9.tar.bz2
cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value.
* cp-tree.h (IDENTIFIER_GLOBAL_VALUE): Use get_namespace_value. (SET_IDENTIFIER_GLOBAL_VALUE): Use set_global_value. (IDENTIFIER_NAMESPACE_VALUE): Delete. * name-lookup.h (namespace_binding, set_namespace_binding): Replace with ... (get_namespace_value, set_global_value): ... these. (get_global_value_if_present, is_typename_at_global_scope): Delete. * decl.c (poplevel): Use get_namespace_value. (grokdeclarator): Use IDENTIFIER_GLOBAL_VALUE. * class.c (build_vtbl_initializer): Stash library decl in static var. Use IDENTIFIER_GLOBAL_VALUE. * except.c (do_get_exception_ptr, do_begin_catch, do_end_catch) do_allocate_exception, do_free_exception, build_throw): Likewise. * init.c (throw_bad_array_new_length): Likewise. * rtti.c (throw_bad_cast, throw_bad_typeid): Likewise. * name-lookup.c (arg_assoc_namespace, pushdecl_maybe_friend_1) check_for_our_of_scope_variable, push_overloaded_decl_1): Use get_namespace_value. (set_namespace_binding_1): Rename to (set_namespace_binding): ... here. (set_global_value): New. (lookup_name_innermost_nonclass_level_1, push_namespace): Use get_namespace_value. * pt.c (listify): Use get_namespace_value. ((--This line, and those below, will be ignored-- M cp/name-lookup.c M cp/name-lookup.h M cp/ChangeLog M cp/except.c M cp/class.c M cp/pt.c M cp/init.c M cp/cp-tree.h M cp/decl.c M cp/rtti.c From-SVN: r247654
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r--gcc/cp/rtti.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 94b8fe7..89d1891 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -202,10 +202,15 @@ build_headof (tree exp)
static tree
throw_bad_cast (void)
{
- tree fn = get_identifier ("__cxa_bad_cast");
- if (!get_global_value_if_present (fn, &fn))
- fn = push_throw_library_fn (fn, build_function_type_list (ptr_type_node,
- NULL_TREE));
+ static tree fn;
+ if (!fn)
+ {
+ tree name = get_identifier ("__cxa_bad_cast");
+ fn = IDENTIFIER_GLOBAL_VALUE (name);
+ if (!fn)
+ fn = push_throw_library_fn
+ (name, build_function_type_list (ptr_type_node, NULL_TREE));
+ }
return build_cxx_call (fn, 0, NULL, tf_warning_or_error);
}
@@ -216,14 +221,17 @@ throw_bad_cast (void)
static tree
throw_bad_typeid (void)
{
- tree fn = get_identifier ("__cxa_bad_typeid");
- if (!get_global_value_if_present (fn, &fn))
+ static tree fn;
+ if (!fn)
{
- tree t;
-
- t = build_reference_type (const_type_info_type_node);
- t = build_function_type_list (t, NULL_TREE);
- fn = push_throw_library_fn (fn, t);
+ tree name = get_identifier ("__cxa_bad_typeid");
+ fn = IDENTIFIER_GLOBAL_VALUE (name);
+ if (!fn)
+ {
+ tree t = build_reference_type (const_type_info_type_node);
+ t = build_function_type_list (t, NULL_TREE);
+ fn = push_throw_library_fn (name, t);
+ }
}
return build_cxx_call (fn, 0, NULL, tf_warning_or_error);