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]

PATCH: Another demangler patch for member function qualifiers


Michael Elizabeth Chastain found another case in which the new
demangler code failed to handle member function qualifiers correctly.
When a pointer to a member function was passed as a parameter to a
qualified member function, the outer qualifier could in some cases be
picked up when printing the parameter.  This patch fixes the bug, and
adds a test case for it.

I am about to check this in.

Ian


2003-12-15  Ian Lance Taylor  <ian@wasabisystems.com>

	* cp-demangle.c (d_print_function_type): Print the function
	parameters with no modifiers.
	* testsuite/demangle-expected: Add test case.


Index: cp-demangle.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/cp-demangle.c,v
retrieving revision 1.59
diff -u -p -r1.59 cp-demangle.c
--- cp-demangle.c	15 Dec 2003 23:18:49 -0000	1.59
+++ cp-demangle.c	15 Dec 2003 23:25:11 -0000
@@ -3396,7 +3396,14 @@ d_print_function_type (dpi, dc, mods)
   d_append_char (dpi, '(');
 
   if (d_right (dc) != NULL)
-    d_print_comp (dpi, d_right (dc));
+    {
+      struct d_print_mod *hold_modifiers;
+
+      hold_modifiers = dpi->modifiers;
+      dpi->modifiers = NULL;
+      d_print_comp (dpi, d_right (dc));
+      dpi->modifiers = hold_modifiers;
+    }
 
   d_append_char (dpi, ')');
 
Index: testsuite/demangle-expected
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/testsuite/demangle-expected,v
retrieving revision 1.23
diff -u -p -r1.23 demangle-expected
--- testsuite/demangle-expected	15 Dec 2003 14:37:25 -0000	1.23
+++ testsuite/demangle-expected	15 Dec 2003 23:25:12 -0000
@@ -2916,6 +2916,11 @@ void f<-1>()
 _ZNSdD0Ev
 std::basic_iostream<char, std::char_traits<char> >::~basic_iostream()
 #
+# Another case where we got member function qualifiers wrong.
+--format=gnu-v3
+_ZNK15nsBaseHashtableI15nsUint32HashKey8nsCOMPtrI4IFooEPS2_E13EnumerateReadEPF15PLDHashOperatorRKjS4_PvES9_
+nsBaseHashtable<nsUint32HashKey, nsCOMPtr<IFoo>, IFoo*>::EnumerateRead(PLDHashOperator (*)(unsigned int const&, IFoo*, void*), void*) const
+#
 # This caused an infinite loop.
 #
 # This is generated by an EDG compiler (kcc 4.0).  To demangle it


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