Commit 5427d758 by Michael Tiemann Committed by Jason Merrill

rtti.c (get_tinfo_fn_dynamic): If this function is called an FLAG_RTTI is unset...

	* rtti.c (get_tinfo_fn_dynamic): If this function is called an
	FLAG_RTTI is unset, initialize type info machinery and continue
	with FLAG_RTTI enabled.
	(get_typeid): Ditto.

From-SVN: r18401
parent 8f279ed7
Wed Mar 4 12:11:53 1998 Michael Tiemann <tiemann@axon.cygnus.com>
* rtti.c (get_tinfo_fn_dynamic): If this function is called an
FLAG_RTTI is unset, initialize type info machinery and continue
with FLAG_RTTI enabled.
(get_typeid): Ditto.
Wed Mar 4 11:47:55 1998 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (unary_complex_lvalue): &D::i has type B::* if i comes
......
......@@ -1578,6 +1578,11 @@ we are concerned here about a lower-level interface primarily
intended for methods written in Java, but that can also be used for C++
(and less easily C).
Note that on systems that follow BSD tradition, a C identifier @code{var}
would get "mangled" into the assembler name @samp{_var}. On such
systems, all other mangled names are also prefixed by a @samp{_}
which is not shown in the following examples.
@subsection Method name mangling
C++ mangles a method by emitting the function name, followed by @code{__},
......@@ -1646,6 +1651,7 @@ entire mangled method name is followed by a @samp{U}.
For example, the method @code{X\u0319::M\u002B(int)} is encoded as
@samp{M_002b__U6X_0319iU}.
@subsection Pointer and reference types
A C++ pointer type is mangled as @samp{P} followed by the
......@@ -1706,6 +1712,28 @@ as if it were the C++ type @code{JArray<T>}.
For example @code{java.lang.String[]} is encoded as
@samp{Pt6JArray1ZPQ34java4lang6String}.
@subsection Static fields
Both C++ and Java classes can have static fields.
These are allocated statically, and are shared among all instances.
The mangling starts with a prefix (@samp{_} in most systems), which is
followed by the mangling
of the class name, followed by the "joiner" and finally the field name.
The joiner (see @code{JOINER} in @code{cp-tree.h}) is a special
separator character. For historical reasons (and idiosyncracies
of assembler syntax) it can @samp{$} or @samp{.} (or even
@samp{_} on a few systems). If the joiner is @samp{_} then the prefix
is @samp{__static_} instead of just @samp{_}.
For example @code{Foo::Bar::var} (or @code{Foo.Bar.var} in Java syntax)
would be encoded as @samp{_Q23Foo3Bar$var} or @samp{_Q23Foo3Bar.var}
(or rarely @samp{__static_Q23Foo3Bar_var}).
If the name of a static variable needs Unicode escapes,
the Unicode indicator @samp{U} comes before the "joiner".
This @code{\u1234Foo::var\u3445} becomes @code{_U8_1234FooU.var_3445}.
@subsection Table of demangling code characters
The following special characters are used in mangling:
......
......@@ -846,6 +846,7 @@ init_lex ()
UNSET_RESERVED_WORD ("classof");
UNSET_RESERVED_WORD ("headof");
}
if (! flag_handle_signatures || flag_no_gnu_keywords)
{
/* Easiest way to not recognize signature
......
......@@ -205,7 +205,13 @@ get_tinfo_fn_dynamic (exp)
tree t;
if (! flag_rtti)
warning ("taking dynamic typeid of object without -frtti");
{
warning ("taking dynamic typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
flag_rtti = 1;
}
/* If we don't have rtti stuff, get to a sub-object that does. */
if (! CLASSTYPE_VFIELDS (type))
......@@ -387,6 +393,15 @@ get_typeid (type)
if (type == error_mark_node)
return error_mark_node;
if (! flag_rtti)
{
warning ("requesting typeid of object without -frtti");
push_obstacks (&permanent_obstack, &permanent_obstack);
init_rtti_processing ();
pop_obstacks ();
flag_rtti = 1;
}
if (processing_template_decl)
return build_min_nt (TYPEID_EXPR, type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment