This is the mail archive of the gcc-patches@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]

ObjC/ObjC++ - demangling of method and function names


This patch does a few things:

 * it fixes demangling C++ function names when compiling Objective-C++ (eg, __PRETTY_FUNCTION__ inside a C++
member function)

 * it fixes demangling Objective-C/Objective-C++ method names when they have no arguments and contain a '_' 
(not as the last character though).  It's impossible to always get demangling right, but I managed
to at least get "-(id)test_method" to demangle right. ;-)

 * it fixes Objective-C++ error messages to say "In function '-[NSObject release]' ..." instead of 
"In function '_i_NSObject__release' ..." :-)

 * it adds comments about the problems and ideas about how we could do the whole Objective-C/Objective-C++
pretty printing of method names much better (could be for next release).

Three testcases are included, none of which would pass before this patch.  A fourth testcase for the 
"In function '-[NSObject release]' ..." is included but has a TODO for the actual check because that line 
is automatically filtered out by the test suite.  It's a minor TODO and I can fix that in stage 3 or for next release 
maybe (didn't want to spend hours looking at the testsuite right now).  (the testcase would actually pass, it's a
testsuite issue)

Ok to apply to trunk ?

Thanks

PS: This does not fix the "'release' is deprecated" (instead of "'-[NSObject release]' is deprecated") message.  That
may be yet another patch.

In gcc/cp/:
2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>

        * tree.c (cxx_printable_name_internal): In Objective-C++, call
        objc_maybe_printable_name.

In gcc/objc/:
2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc-act.c (OBJC_GEN_METHOD_LABEL): Updated comments.
        (objc_demangle): Return NULL if demangling can not be done because
        the string to demangle is not an Objective-C mangled method name.
        Be smarter in demangling method names so that at least for methods
        with no arguments we are able to almost always demangle '_' correctly.
        Updated comments.
        (objc_maybe_printable_name): New.
        (objc_printable_name): Call objc_maybe_printable_name.  If it
        returns NULL, call cxx_printable_name in Objective-C++.

In gcc/testsuite/:
2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc.dg/demangle-1.m: New test.
        * obj-c++.dg/demangle-1.mm: New test.
        * obj-c++.dg/demangle-2.mm: New test.
        * obj-c++.dg/demangle-3.mm: New test.   

In gcc/c-family/:
2010-10-23  Nicola Pero  <nicola.pero@meta-innovation.com>

        * c-common.h (objc_maybe_printable_name): New.
        * stub-objc.c (objc_maybe_printable_name): New.

Attachment: patch.txt
Description: Text document


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