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]

Re: Objective-C name (de)mangling


kaih@khms.westfalen.de (Kai Henningsen) writes:

> I believe the demanglers currently handle C++ and (at least one of them)  
> Java, but not Objective-C. (Correct?)

Correct.

> Objective-C name mangling is fairly simple - perhaps too simple: it is not  
> always reversible in the face of original identifiers with underscores.

A mangling which is not reversible is probably ambiguous.  It looks to
me as though if you carefully shift underscores from the start to the
end of selector names (e.g., foo_:bar to foo:_bar), you can get the
same mangled name for different methods.

But then I don't know Objective C at all.

If you want to add demangling support, write the demangler and put it
in libiberty, probably in a new source file, add a new style to
include/demangle.h (e.g., DMGL_OBJC), modify cplus_demangle() in
libiberty/cplus-dem.c to detect the style and call your new demangler,
and add your new style to libiberty_demanglers[] in
libiberty/cplus-dem.c.

After that, c++filt and the binutils programs should more or less just
work--that is, you should be able to use something like
--demangle=objc to demangle Objective C names.

Ian


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