This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Objective-C name (de)mangling
- From: kaih at khms dot westfalen dot de (Kai Henningsen)
- To: gcc at gcc dot gnu dot org
- Date: 05 Jan 2004 20:02:00 +0200
- Subject: Objective-C name (de)mangling
- Comment: Unsolicited commercial mail will incur an US$100 handling fee per received mail.
- Organization: Organisation? Me?! Are you kidding?
Given how much work is currently done on the demanglers, and reviving
Objective-C++, maybe we ought to review the state of the art wrt.
Objective-C and name mangling.
I believe the demanglers currently handle C++ and (at least one of them)
Java, but not Objective-C. (Correct?)
Objective-C name mangling is fairly simple - perhaps too simple: it is not
always reversible in the face of original identifiers with underscores.
I know of the following mangling rules:
Class methods: _c_<classname>_<category>_<method>
Instance methods: _i_<classname>_<category>_<method>
where <method> is all parts of the selector name concatenated, and colons
translated to underscores.
That is, a mangled name of _i_class1__method2_arg2_ corresponds to a
__PRETTY_FUNCTION__ of "-[class1 method2:arg2:]".
Then there are various prefixes that get put in front of mangled names for
internal data, such as
_OBJC_CATEGORY_CLASS_METHODS_<classname>_<category>
_OBJC_CATEGORY_INSTANCE_METHODS_<classname>_<category>
_OBJC_CATEGORY_<classname>_<category>
_OBJC_CLASS_METHODS_<classname>
_OBJC_CLASS_VARIABLES_<classname>
_OBJC_CLASS_<classname>
_OBJC_INSTANCE_METHODS_<classname>
_OBJC_METACLASS_<classname>
__objc_category_name_<classname>_<category>
__objc_class_name_<classname>
__objc_class_ref_<classname>
MfG Kai