This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Objective-C name (de)mangling


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_cat3_method2_arg2_ corresponds to a  
__PRETTY_FUNCTION__ of "-[class1(cat3) 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]