Mercurial > hg > CbC > CbC_gcc
diff gcc/cp/rtti.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children | 1830386684a0 |
line wrap: on
line diff
--- a/gcc/cp/rtti.c Fri Oct 27 22:46:09 2017 +0900 +++ b/gcc/cp/rtti.c Thu Oct 25 07:37:49 2018 +0900 @@ -1,5 +1,5 @@ /* RunTime Type Identification - Copyright (C) 1995-2017 Free Software Foundation, Inc. + Copyright (C) 1995-2018 Free Software Foundation, Inc. Mostly written by Jason Merrill (jason@cygnus.com). This file is part of GCC. @@ -206,8 +206,7 @@ index = build_int_cst (NULL_TREE, -2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE); - offset = build_vtbl_ref (cp_build_indirect_ref (exp, RO_NULL, - tf_warning_or_error), + offset = build_vtbl_ref (cp_build_fold_indirect_ref (exp), index); type = cp_build_qualified_type (ptr_type_node, @@ -274,7 +273,7 @@ exp = resolve_nondeduced_context (exp, complain); /* peel back references, so they match. */ - type = non_reference (TREE_TYPE (exp)); + type = non_reference (unlowered_expr_type (exp)); /* Peel off cv qualifiers. */ type = TYPE_MAIN_VARIANT (type); @@ -303,7 +302,7 @@ /* Otherwise return the type_info for the static type of the expr. */ t = get_tinfo_ptr (TYPE_MAIN_VARIANT (type)); - return cp_build_indirect_ref (t, RO_NULL, complain); + return cp_build_fold_indirect_ref (t); } static bool @@ -318,10 +317,10 @@ if (!COMPLETE_TYPE_P (const_type_info_type_node)) { gcc_rich_location richloc (input_location); - maybe_add_include_fixit (&richloc, "<typeinfo>"); - error_at_rich_loc (&richloc, - "must %<#include <typeinfo>%> before using" - " %<typeid%>"); + maybe_add_include_fixit (&richloc, "<typeinfo>", false); + error_at (&richloc, + "must %<#include <typeinfo>%> before using" + " %<typeid%>"); return false; } @@ -365,7 +364,7 @@ exp = cp_build_addr_expr (exp, complain); exp = save_expr (exp); cond = cp_convert (boolean_type_node, exp, complain); - exp = cp_build_indirect_ref (exp, RO_NULL, complain); + exp = cp_build_fold_indirect_ref (exp); } exp = get_tinfo_decl_dynamic (exp, complain); @@ -529,7 +528,7 @@ if (!type) return error_mark_node; - return cp_build_indirect_ref (get_tinfo_ptr (type), RO_NULL, complain); + return cp_build_fold_indirect_ref (get_tinfo_ptr (type)); } /* Check whether TEST is null before returning RESULT. If TEST is used in @@ -617,22 +616,22 @@ else { expr = mark_lvalue_use (expr); - - exprtype = build_reference_type (TREE_TYPE (expr)); + exprtype = TREE_TYPE (expr); /* T is a reference type, v shall be an lvalue of a complete class type, and the result is an lvalue of the type referred to by T. */ - - if (! MAYBE_CLASS_TYPE_P (TREE_TYPE (exprtype))) + if (! MAYBE_CLASS_TYPE_P (exprtype)) { errstr = _("source is not of class type"); goto fail; } - if (!COMPLETE_TYPE_P (complete_type (TREE_TYPE (exprtype)))) + if (!COMPLETE_TYPE_P (complete_type (exprtype))) { errstr = _("source is of incomplete class type"); goto fail; } + + exprtype = cp_build_reference_type (exprtype, !lvalue_p (expr)); } /* The dynamic_cast operator shall not cast away constness. */