From 2215f7320e000a724667658ca60492a05629db86 Mon Sep 17 00:00:00 2001 From: Carlo Wood Date: Fri, 7 Nov 2003 03:49:43 +0000 Subject: [PATCH] demangle.h (qualifier_list::decode_qualifiers(string_type&, string_type&, bool) const): Made const. * include/bits/demangle.h (qualifier_list::decode_qualifiers(string_type&, string_type&, bool) const): Made const. (qualifier_list::M_printing_suppressed): Added mutable. (_GLIBCXX_DEMANGLER_DOUT_ENTERING3, _GLIBCXX_DEMANGLER_RETURN3, std::ostream& operator<<(std::ostream&, qualifier const&), std::ostream& operator<<(std::ostream&, qualifier_list const&), qualifier_list::decode_qualifiers(string_type&, string_type&, bool) const, session::decode_type_with_postfix(string_type&, string_type&, qualifier_list*)) Added and/or changed debug-only hooks and code. From-SVN: r73327 --- libstdc++-v3/ChangeLog | 15 +++++++++ libstdc++-v3/include/bits/demangle.h | 60 ++++++++++++++++++++++++++++++------ 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8a54ea2..68c8571 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,18 @@ +2003-11-07 Carlo Wood + + * include/bits/demangle.h + (qualifier_list::decode_qualifiers(string_type&, + string_type&, bool) const): Made const. + (qualifier_list::M_printing_suppressed): Added mutable. + (_GLIBCXX_DEMANGLER_DOUT_ENTERING3, _GLIBCXX_DEMANGLER_RETURN3, + std::ostream& operator<<(std::ostream&, qualifier const&), + std::ostream& operator<<(std::ostream&, qualifier_list const&), + qualifier_list::decode_qualifiers(string_type&, + string_type&, bool) const, + session::decode_type_with_postfix(string_type&, + string_type&, qualifier_list*)) + Added and/or changed debug-only hooks and code. + 2003-11-04 Jeffrey D. Oldham * libsupc++/vec.cc (__cxa_vec_delete2): If given a NULL pointer, diff --git a/libstdc++-v3/include/bits/demangle.h b/libstdc++-v3/include/bits/demangle.h index 4d2fa39..901eaa7 100644 --- a/libstdc++-v3/include/bits/demangle.h +++ b/libstdc++-v3/include/bits/demangle.h @@ -40,10 +40,10 @@ #define _GLIBCXX_DEMANGLER_DOUT(cntrl, data) #define _GLIBCXX_DEMANGLER_DOUT_ENTERING(x) #define _GLIBCXX_DEMANGLER_DOUT_ENTERING2(x) -#define _GLIBCXX_DEMANGLER_RETURN \ - return M_result -#define _GLIBCXX_DEMANGLER_RETURN2 \ - return M_result +#define _GLIBCXX_DEMANGLER_DOUT_ENTERING3(x) +#define _GLIBCXX_DEMANGLER_RETURN return M_result +#define _GLIBCXX_DEMANGLER_RETURN2 return M_result +#define _GLIBCXX_DEMANGLER_RETURN3 #define _GLIBCXX_DEMANGLER_FAILURE \ do { M_result = false; return false; } while(0) #else @@ -192,6 +192,28 @@ namespace __gnu_cxx part_of_substitution(void) const { return M_part_of_substitution; } +#if _GLIBCXX_DEMANGLER_CWDEBUG + friend std::ostream& operator<<(std::ostream& os, qualifier const& qual) + { + os << (char)qual.M_qualifier1; + if (qual.M_qualifier1 == vendor_extension || + qual.M_qualifier1 == array || + qual.M_qualifier1 == pointer_to_member) + os << " [" << qual.M_optional_type << ']'; + else if (qual.M_qualifier1 == 'K' || + qual.M_qualifier1 == 'V' || + qual.M_qualifier1 == 'r') + { + if (qual.M_qualifier2) + { + os << (char)qual.M_qualifier2; + if (qual.M_qualifier3) + os << (char)qual.M_qualifier3; + } + } + return os; + } +#endif }; template @@ -201,7 +223,7 @@ namespace __gnu_cxx string_type; private: - bool M_printing_suppressed; + mutable bool M_printing_suppressed; std::vector, Allocator> M_qualifier_starts; session& M_demangler; @@ -240,7 +262,7 @@ namespace __gnu_cxx void decode_qualifiers(string_type& prefix, string_type& postfix, - bool member_function_pointer_qualifiers); + bool member_function_pointer_qualifiers) const; bool suppressed(void) const @@ -254,6 +276,23 @@ namespace __gnu_cxx size(void) const { return M_qualifier_starts.size(); } +#if _GLIBCXX_DEMANGLER_CWDEBUG + friend std::ostream& operator<<(std::ostream& os, qualifier_list const& list) + { + typename std::vector, Allocator>::const_iterator + iter = list.M_qualifier_starts.begin(); + if (iter != list.M_qualifier_starts.end()) + { + os << "{ " << *iter; + while (++iter != list.M_qualifier_starts.end()) + os << ", " << *iter; + os << " }"; + } + else + os << "{ }"; + return os; + } +#endif }; template @@ -1377,10 +1416,11 @@ namespace __gnu_cxx qualifier_list::decode_qualifiers( string_type& prefix, string_type& postfix, - bool member_function_pointer_qualifiers = false) + bool member_function_pointer_qualifiers = false) const { + _GLIBCXX_DEMANGLER_DOUT_ENTERING3("decode_qualifiers"); for(typename std::vector, Allocator>:: - reverse_iterator iter = M_qualifier_starts.rbegin(); + const_reverse_iterator iter = M_qualifier_starts.rbegin(); iter != M_qualifier_starts.rend();) { if (!member_function_pointer_qualifiers @@ -1442,6 +1482,7 @@ namespace __gnu_cxx ++iter; } M_printing_suppressed = false; + _GLIBCXX_DEMANGLER_RETURN3; } // @@ -1451,8 +1492,7 @@ namespace __gnu_cxx string_type& prefix, string_type& postfix, qualifier_list* qualifiers) { - _GLIBCXX_DEMANGLER_DOUT_ENTERING2 - (qualifiers ? "decode_type" : "decode_type[with qualifiers]"); + _GLIBCXX_DEMANGLER_DOUT_ENTERING2("decode_type"); ++M_inside_type; bool recursive_template_param_or_substitution_call; if (!(recursive_template_param_or_substitution_call = qualifiers)) -- 2.7.4