@@ -65,7 +65,7 @@ along with this program; if not, write to the
6565
6666#include "toplev.h" /* ident_hash */
6767
68- #define GCC_XML_C_VERSION "$Revision: 1.124 $"
68+ #define GCC_XML_C_VERSION "$Revision: 1.128 $"
6969
7070/*--------------------------------------------------------------------------*/
7171/* Data structures for the actual XML dump. */
@@ -1100,7 +1100,74 @@ xml_document_add_attribute_static_method(xml_document_element_p element)
11001100}
11011101
11021102/*--------------------------------------------------------------------------*/
1103- /* Print XML attributes virtual="" and pure_virtual="" for a decl. */
1103+ static int
1104+ xml_print_overrides_r (xml_dump_info_p xdi , tree type , tree fndecl );
1105+
1106+ static int
1107+ xml_print_overrides (xml_dump_info_p xdi , tree type , tree fndecl )
1108+ {
1109+ tree binfo = TYPE_BINFO (type );
1110+ tree base_binfo ;
1111+ int ix ;
1112+ int found = 0 ;
1113+
1114+ for (ix = 0 ; BINFO_BASE_ITERATE (binfo , ix , base_binfo ); ix ++ )
1115+ {
1116+ tree basetype = BINFO_TYPE (base_binfo );
1117+
1118+ if (TYPE_POLYMORPHIC_P (basetype ))
1119+ {
1120+ found += xml_print_overrides_r (xdi , basetype , fndecl );
1121+ }
1122+ }
1123+ return found ;
1124+ }
1125+
1126+ /* Look in TYPE for virtual functions overrides by FNDECL. Check both
1127+ TYPE itself and its bases. */
1128+ static int
1129+ xml_print_overrides_r (xml_dump_info_p xdi , tree type , tree fndecl )
1130+ {
1131+ tree fn = look_for_overrides_here (type , fndecl );
1132+
1133+ if (fn )
1134+ {
1135+ int id = xml_add_node (xdi , fn , 1 );
1136+
1137+ if (id )
1138+ {
1139+ fprintf (xdi -> file , "_%d " , id );
1140+ }
1141+
1142+ return 1 ;
1143+ }
1144+
1145+ /* We failed to find one declared in this class. Look in its bases. */
1146+ return xml_print_overrides (xdi , type , fndecl );
1147+ }
1148+
1149+ static void
1150+ xml_print_overrides_method_attribute (xml_dump_info_p xdi , tree d )
1151+ {
1152+ if (DECL_VIRTUAL_P (d ))
1153+ {
1154+ fprintf (xdi -> file , " overrides=\"" );
1155+ xml_print_overrides (xdi , CP_DECL_CONTEXT (d ), d );
1156+ fprintf (xdi -> file , "\"" );
1157+ }
1158+ }
1159+
1160+ static void
1161+ xml_document_add_attribute_overrides_method (xml_document_element_p element )
1162+ {
1163+ xml_document_add_attribute (element , "overrides" ,
1164+ xml_document_attribute_type_idrefs ,
1165+ xml_document_attribute_use_optional , 0 );
1166+ }
1167+
1168+ /*--------------------------------------------------------------------------*/
1169+ /* Print XML attributes virtual="", overrides="", and pure_virtual=""
1170+ for a decl. */
11041171static void
11051172xml_print_virtual_method_attributes (xml_dump_info_p xdi , tree d )
11061173{
@@ -1113,6 +1180,8 @@ xml_print_virtual_method_attributes (xml_dump_info_p xdi, tree d)
11131180 {
11141181 fprintf (xdi -> file , " pure_virtual=\"1\"" );
11151182 }
1183+
1184+ xml_print_overrides_method_attribute (xdi , d );
11161185}
11171186
11181187static void
@@ -1124,6 +1193,7 @@ xml_document_add_attribute_virtual_method(xml_document_element_p element)
11241193 xml_document_add_attribute (element , "pure_virtual" ,
11251194 xml_document_attribute_type_boolean ,
11261195 xml_document_attribute_use_optional , "0" );
1196+ xml_document_add_attribute_overrides_method (element );
11271197}
11281198
11291199/*--------------------------------------------------------------------------*/
@@ -3273,16 +3343,16 @@ xml_add_node (xml_dump_info_p xdi, tree n, int complete)
32733343 synthesize_method (n );
32743344 pop_from_top_level ();
32753345
3276- /* If an error occurred (and was suppressed) then this function is
3277- invalid and should not be included. */
3278- if (diagnostic_xml_synthesize_test > 1 )
3279- {
3280- diagnostic_xml_synthesize_test = 0 ;
3281- return 0 ;
3282- }
3346+ /* Error messages have been converted to GCCXML_DECL_ERROR marks. */
32833347 diagnostic_xml_synthesize_test = 0 ;
32843348 }
32853349
3350+ /* Skip synthesized invalid compiler-generated functions. */
3351+ if (TREE_CODE (n ) == FUNCTION_DECL && GCCXML_DECL_ERROR (n ))
3352+ {
3353+ return 0 ;
3354+ }
3355+
32863356 /* Some nodes don't need to be dumped and just refer to other nodes.
32873357 These nodes should can have index zero because they should never
32883358 be referenced. */
0 commit comments