+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
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{__},
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
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:
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))
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);