logo       

[drow-cplus-branch] Print qualifiers on methods: msg#00588

Subject: [drow-cplus-branch] Print qualifiers on methods
David Carlton pointed out that when I switched to printing methods by their
type I lost the const/volatile qualifiers for methods.  They're stored as
the type of the THIS pointer in the argument list.  This patch recovers
them; committed just to the branch since the surrounding code is quite
different from the trunk.  I'll move it over when I've finished with my work
on the type printer.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2002-10-28  Daniel Jacobowitz  <drow@xxxxxxxxxx>

        * c-typeprint.c (c_type_print_base): Print method qualifiers.

Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.22.10.2
diff -u -p -r1.22.10.2 c-typeprint.c
--- c-typeprint.c       26 Oct 2002 17:12:04 -0000      1.22.10.2
+++ c-typeprint.c       29 Oct 2002 03:06:01 -0000
@@ -1000,6 +1000,26 @@ c_type_print_base (struct type *type, st
                                             method_name,
                                             TYPE_FN_FIELD_STATIC_P (f, j),
                                             stream);
+
+                 /* If the method is const or volatile, this will show up as
+                    a qualifier on the first argument.  Handle a missing or
+                    corrupt THIS pointer gracefully, since we shouldn't crash
+                    on corrupt debug information (if we're going to complain
+                    about this it should be in the debug readers, not this
+                    late).  */
+                 if (!TYPE_FN_FIELD_STATIC_P (f, j)
+                     && TYPE_NFIELDS (TYPE_FN_FIELD_TYPE (f, j)) > 0)
+                   {
+                     struct type *method_type, *this_ptr_type, *this_type;
+                     method_type = TYPE_FN_FIELD_TYPE (f, j);
+                     this_ptr_type = TYPE_FIELDS (method_type)[0].type;
+                     if (TYPE_CODE (this_ptr_type) == TYPE_CODE_PTR)
+                       {
+                         this_type = TYPE_TARGET_TYPE (this_ptr_type);
+                         c_type_print_modifier (this_type, stream, 1, 0);
+                       }
+                   }
+
                  fprintf_filtered (stream, ";\n");
                }
            }



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe