+2010-05-12 Jason Merrill <jason@redhat.com>
+
+ PR bootstrap/44048
+ PR target/44099
+ * dbxout.c (dbxout_type): Remove NULLPTR_TYPE handling.
+ * sdbout.c (plain_type_1): Likewise.
+ * dwarf2out.c (is_base_type): Likewise.
+ (gen_type_die_with_usage): Likewise. Generate
+ DW_TAG_unspecified_type for any LANG_TYPE.
+
2010-05-12 Jan Hubicka <jh@suse.cz>
* cgraphbuild.c (build_cgraph_edges, rebuild_cgraph_edges): Build
2010-05-12 Jason Merrill <jason@redhat.com>
+ PR bootstrap/44048
+ PR target/44099
+ * cp-tree.def (NULLPTR_TYPE): Remove.
+ * cp-tree.h (NULLPTR_TYPE_P): New.
+ (SCALAR_TYPE_P): Use it.
+ (nullptr_type_node): New.
+ (cp_tree_index): Add CPTI_NULLPTR_TYPE.
+ * decl.c (cxx_init_decl_processing): Call record_builtin_type on
+ nullptr_type_node.
+ * cvt.c (ocp_convert): Use NULLPTR_TYPE_P instead of NULLPTR_TYPE.
+ * cxx-pretty-print.c (pp_cxx_constant): Likewise.
+ * error.c (dump_type, dump_type_prefix, dump_type_suffix): Likewise.
+ * mangle.c (write_type): Likewise.
+ * name-lookup.c (arg_assoc_type): Likewise.
+ * typeck.c (build_reinterpret_cast_1): Likewise.
+ * rtti.c (typeinfo_in_lib_p): Likewise.
+ (emit_support_tinfos): Remove local nullptr_type_node.
+
* cp-tree.h (UNKNOWN_TYPE): Remove.
* decl.c (cxx_init_decl_processing): Use LANG_TYPE instead.
* error.c (dumy_type, dump_type_prefix, dump_type_suffix): Likewise.
an rvalue of type std::nullptr_t. */
t = integral_constant_value (t);
if (t == null_node
- || TREE_CODE (TREE_TYPE (t)) == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (TREE_TYPE (t)))
return true;
if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t))
{
null pointer constant of integral type can be converted to an
rvalue of type std::nullptr_t. */
if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to)
- || tcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (to))
&& expr && null_ptr_cst_p (expr))
conv = build_conv (ck_std, to, conv);
else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
|| UNSCOPED_ENUM_P (from)
|| fcode == POINTER_TYPE
|| TYPE_PTR_TO_MEMBER_P (from)
- || fcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (from))
{
conv = build_conv (ck_std, to, conv);
if (fcode == POINTER_TYPE
|| TYPE_PTRMEM_P (from)
|| (TYPE_PTRMEMFUNC_P (from)
&& conv->rank < cr_pbool)
- || fcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (from))
conv->rank = cr_pbool;
return conv;
}
< TYPE_PRECISION (double_type_node))
&& !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (arg))))
arg = convert_to_real (double_type_node, arg);
- else if (TREE_CODE (TREE_TYPE (arg)) == NULLPTR_TYPE)
+ else if (NULLPTR_TYPE_P (TREE_TYPE (arg)))
arg = null_pointer_node;
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (arg)))
arg = perform_integral_promotions (arg);
instantiation time. */
DEFTREECODE (TEMPLATE_INFO, "template_info", tcc_exceptional, 0)
-/* The type of a nullptr expression. This is a C++0x extension. */
-DEFTREECODE (NULLPTR_TYPE, "decltype(nullptr)", tcc_type, 0)
-
/*
Local variables:
mode:c
CPTI_KEYED_CLASSES,
CPTI_NULLPTR,
+ CPTI_NULLPTR_TYPE,
CPTI_MAX
};
#define global_delete_fndecl cp_global_trees[CPTI_GLOBAL_DELETE_FNDECL]
#define current_aggr cp_global_trees[CPTI_AGGR_TAG]
#define nullptr_node cp_global_trees[CPTI_NULLPTR]
+#define nullptr_type_node cp_global_trees[CPTI_NULLPTR_TYPE]
/* We cache these tree nodes so as to call get_identifier less
frequently. */
|| TREE_CODE (TYPE) == REAL_TYPE \
|| TREE_CODE (TYPE) == COMPLEX_TYPE)
+/* True iff TYPE is cv decltype(nullptr). */
+#define NULLPTR_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == LANG_TYPE \
+ && TYPE_MAIN_VARIANT (TYPE) == nullptr_type_node)
+
/* [basic.types]
Arithmetic types, enumeration types, pointer types,
|| ARITHMETIC_TYPE_P (TYPE) \
|| TYPE_PTR_P (TYPE) \
|| TYPE_PTRMEMFUNC_P (TYPE) \
- || TREE_CODE (TYPE) == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (TYPE))
/* Determines whether this type is a C++0x scoped enumeration
type. Scoped enumerations types are introduced via "enum class" or
return fold_if_not_in_template (convert_to_integer (type, e));
}
- if (code == NULLPTR_TYPE && e && null_ptr_cst_p (e))
+ if (NULLPTR_TYPE_P (type) && e && null_ptr_cst_p (e))
return nullptr_node;
if (POINTER_TYPE_P (type) || TYPE_PTR_TO_MEMBER_P (type))
return fold_if_not_in_template (cp_convert_to_pointer (type, e));
break;
case INTEGER_CST:
- if (TREE_CODE (TREE_TYPE (t)) == NULLPTR_TYPE)
+ if (NULLPTR_TYPE_P (TREE_TYPE (t)))
{
pp_string (pp, "nullptr");
break;
global_delete_fndecl = push_cp_library_fn (DELETE_EXPR, deltype);
push_cp_library_fn (VEC_DELETE_EXPR, deltype);
- {
- tree nullptr_type_node = make_node (NULLPTR_TYPE);
- TYPE_SIZE (nullptr_type_node) = bitsize_int (GET_MODE_BITSIZE (ptr_mode));
- TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
- TYPE_UNSIGNED (nullptr_type_node) = 1;
- TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
- SET_TYPE_MODE (nullptr_type_node, Pmode);
- nullptr_node = make_node (INTEGER_CST);
- TREE_TYPE (nullptr_node) = nullptr_type_node;
- }
+ nullptr_type_node = make_node (LANG_TYPE);
+ TYPE_SIZE (nullptr_type_node) = bitsize_int (GET_MODE_BITSIZE (ptr_mode));
+ TYPE_SIZE_UNIT (nullptr_type_node) = size_int (GET_MODE_SIZE (ptr_mode));
+ TYPE_UNSIGNED (nullptr_type_node) = 1;
+ TYPE_PRECISION (nullptr_type_node) = GET_MODE_BITSIZE (ptr_mode);
+ SET_TYPE_MODE (nullptr_type_node, Pmode);
+ record_builtin_type (RID_MAX, "decltype(nullptr)", nullptr_type_node);
+ nullptr_node = make_node (INTEGER_CST);
+ TREE_TYPE (nullptr_node) = nullptr_type_node;
}
abort_fndecl
else if (t == unknown_type_node)
pp_string (cxx_pp, M_("<unresolved overloaded function type>"));
else
- gcc_unreachable ();
+ {
+ pp_cxx_cv_qualifier_seq (cxx_pp, t);
+ pp_cxx_tree_identifier (cxx_pp, TYPE_IDENTIFIER (t));
+ }
break;
case TREE_LIST:
pp_cxx_right_paren (cxx_pp);
break;
- case NULLPTR_TYPE:
- pp_string (cxx_pp, "std::nullptr_t");
- break;
-
default:
pp_unsupported_tree (cxx_pp, t);
/* Fall through to error. */
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
- case NULLPTR_TYPE:
dump_type (t, flags);
pp_base (cxx_pp)->padding = pp_before;
break;
case DECLTYPE_TYPE:
case TYPE_PACK_EXPANSION:
case FIXED_POINT_TYPE:
- case NULLPTR_TYPE:
break;
default:
write_char ('E');
break;
- case NULLPTR_TYPE:
- write_string ("Dn");
- break;
-
case TYPEOF_TYPE:
sorry ("mangling typeof, use decltype instead");
break;
+ case LANG_TYPE:
+ if (NULLPTR_TYPE_P (type))
+ {
+ write_string ("Dn");
+ break;
+ }
+ /* else fall through. */
+
default:
gcc_unreachable ();
}
case BOOLEAN_TYPE:
case FIXED_POINT_TYPE:
case DECLTYPE_TYPE:
- case NULLPTR_TYPE:
return false;
case RECORD_TYPE:
if (TYPE_PTRMEMFUNC_P (type))
return false;
case LANG_TYPE:
gcc_assert (type == unknown_type_node
+ || NULLPTR_TYPE_P (type)
|| type == init_list_type_node);
return false;
case TYPE_PACK_EXPANSION:
case BOOLEAN_TYPE:
case REAL_TYPE:
case VOID_TYPE:
- case NULLPTR_TYPE:
return true;
+ case LANG_TYPE:
+ if (NULLPTR_TYPE_P (type))
+ return true;
+ /* else fall through. */
+
default:
return false;
}
{
/* Dummy static variable so we can put nullptr in the array; it will be
set before we actually start to walk the array. */
- static tree nullptr_type_node;
static tree *const fundamentals[] =
{
&void_type_node,
if (!dtor || DECL_EXTERNAL (dtor))
return;
doing_runtime = 1;
- nullptr_type_node = TREE_TYPE (nullptr_node);
for (ix = 0; fundamentals[ix]; ix++)
{
tree bltn = *fundamentals[ix];
an integral type; the conversion has the same meaning and
validity as a conversion of (void*)0 to the integral type. */
if (CP_INTEGRAL_TYPE_P (type)
- && (TYPE_PTR_P (intype) || TREE_CODE (intype) == NULLPTR_TYPE))
+ && (TYPE_PTR_P (intype) || NULLPTR_TYPE_P (intype)))
{
if (TYPE_PRECISION (type) < TYPE_PRECISION (intype))
{
else
return error_mark_node;
}
- if (TREE_CODE (intype) == NULLPTR_TYPE)
+ if (NULLPTR_TYPE_P (intype))
return build_int_cst (type, 0);
}
/* [expr.reinterpret.cast]
{
case VOID_TYPE:
case LANG_TYPE:
- case NULLPTR_TYPE:
/* For a void type, just define it as itself; i.e., "5=5".
This makes us consider it defined
without saying what it is. The debugger will make it
case ENUMERAL_TYPE:
case FUNCTION_TYPE:
case METHOD_TYPE:
- case NULLPTR_TYPE:
case POINTER_TYPE:
case REFERENCE_TYPE:
case OFFSET_TYPE:
when appropriate. */
return;
- case NULLPTR_TYPE:
- {
- dw_die_ref type_die = lookup_type_die (type);
- if (type_die == NULL)
- {
- type_die = new_die (DW_TAG_unspecified_type, comp_unit_die, type);
- add_name_attribute (type_die, "decltype(nullptr)");
- equate_type_number_to_die (type, type_die);
- }
- }
- return;
-
case VOID_TYPE:
case INTEGER_TYPE:
case REAL_TYPE:
break;
case LANG_TYPE:
- /* No Dwarf representation currently defined. */
+ /* Just use DW_TAG_unspecified_type. */
+ {
+ dw_die_ref type_die = lookup_type_die (type);
+ if (type_die == NULL)
+ {
+ tree name = TYPE_NAME (type);
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+ type_die = new_die (DW_TAG_unspecified_type, comp_unit_die, type);
+ add_name_attribute (type_die, IDENTIFIER_POINTER (name));
+ equate_type_number_to_die (type, type_die);
+ }
+ }
break;
default:
switch (TREE_CODE (type))
{
case VOID_TYPE:
- case NULLPTR_TYPE:
return T_VOID;
case BOOLEAN_TYPE:
case INTEGER_TYPE: