===================================================================
@@ -1042,42 +1042,68 @@ class_initializer (tinfo_s *ti, tree tar
for (i = 0; i < n; i++)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, va_arg (extra_inits, tree));
va_end (extra_inits);
init = build_constructor (init_list_type_node, v);
TREE_CONSTANT (init) = 1;
TREE_STATIC (init) = 1;
return init;
}
+/* List of types for which the typeinfo should be placed in the
+ runtime library.
+ 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 *const fundamentals[] =
+{
+ &void_type_node,
+ &boolean_type_node,
+ &wchar_type_node, &char16_type_node, &char32_type_node,
+ &char_type_node, &signed_char_type_node, &unsigned_char_type_node,
+ &short_integer_type_node, &short_unsigned_type_node,
+ &integer_type_node, &unsigned_type_node,
+ &long_integer_type_node, &long_unsigned_type_node,
+ &long_long_integer_type_node, &long_long_unsigned_type_node,
+ &int128_integer_type_node, &int128_unsigned_type_node,
+ &float_type_node, &double_type_node, &long_double_type_node,
+ &dfloat32_type_node, &dfloat64_type_node, &dfloat128_type_node,
+ &nullptr_type_node,
+ 0
+};
+
/* Returns true if the typeinfo for type should be placed in
the runtime library. */
static bool
typeinfo_in_lib_p (tree type)
{
/* The typeinfo objects for `T*' and `const T*' are in the runtime
library for simple types T. */
if (TYPE_PTR_P (type)
&& (cp_type_quals (TREE_TYPE (type)) == TYPE_QUAL_CONST
|| cp_type_quals (TREE_TYPE (type)) == TYPE_UNQUALIFIED))
type = TREE_TYPE (type);
switch (TREE_CODE (type))
{
- case INTEGER_TYPE:
case BOOLEAN_TYPE:
- case REAL_TYPE:
case VOID_TYPE:
case NULLPTR_TYPE:
return true;
+ case INTEGER_TYPE:
+ case REAL_TYPE:
+ for (int ix = 0; fundamentals[ix]; ix++)
+ if (*fundamentals[ix] == type)
+ return true;
+ return false;
+
case LANG_TYPE:
/* fall through. */
default:
return false;
}
}
/* Generate the initializer for the type info describing TYPE. TK_INDEX is
the index of the descriptor in the tinfo_desc vector. */
@@ -1505,38 +1531,20 @@ emit_support_tinfo_1 (tree bltn)
/* Emit the type_info descriptors which are guaranteed to be in the runtime
support. Generating them here guarantees consistency with the other
structures. We use the following heuristic to determine when the runtime
is being generated. If std::__fundamental_type_info is defined, and its
destructor is defined, then the runtime is being built. */
void
emit_support_tinfos (void)
{
- /* 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 *const fundamentals[] =
- {
- &void_type_node,
- &boolean_type_node,
- &wchar_type_node, &char16_type_node, &char32_type_node,
- &char_type_node, &signed_char_type_node, &unsigned_char_type_node,
- &short_integer_type_node, &short_unsigned_type_node,
- &integer_type_node, &unsigned_type_node,
- &long_integer_type_node, &long_unsigned_type_node,
- &long_long_integer_type_node, &long_long_unsigned_type_node,
- &int128_integer_type_node, &int128_unsigned_type_node,
- &float_type_node, &double_type_node, &long_double_type_node,
- &dfloat32_type_node, &dfloat64_type_node, &dfloat128_type_node,
- &nullptr_type_node,
- 0
- };
int ix;
tree bltn_type, dtor;
push_abi_namespace ();
bltn_type = xref_tag (class_type,
get_identifier ("__fundamental_type_info"),
/*tag_scope=*/ts_current, false);
pop_abi_namespace ();
if (!COMPLETE_TYPE_P (bltn_type))
return;