+ if (VEC_length (xmethod_worker_ptr, xm_worker_vec) > 0)
+ {
+ ext_method_oload_champ = find_oload_champ (args, nargs,
+ 0, NULL, xm_worker_vec,
+ NULL, &ext_method_badness);
+ ext_method_match_quality = classify_oload_match (ext_method_badness,
+ nargs, 0);
+ make_cleanup (xfree, ext_method_badness);
+ make_cleanup (free_xmethod_worker_vec, xm_worker_vec);
+ }
+
+ if (src_method_oload_champ >= 0 && ext_method_oload_champ >= 0)
+ {
+ switch (compare_badness (ext_method_badness, src_method_badness))
+ {
+ case 0: /* Src method and xmethod are equally good. */
+ /* If src method and xmethod are equally good, then
+ xmethod should be the winner. Hence, fall through to the
+ case where a xmethod is better than the source
+ method, except when the xmethod match quality is
+ non-standard. */
+ /* FALLTHROUGH */
+ case 1: /* Src method and ext method are incompatible. */
+ /* If ext method match is not standard, then let source method
+ win. Otherwise, fallthrough to let xmethod win. */
+ if (ext_method_match_quality != STANDARD)
+ {
+ method_oload_champ = src_method_oload_champ;
+ method_badness = src_method_badness;
+ ext_method_oload_champ = -1;
+ method_match_quality = src_method_match_quality;
+ break;
+ }
+ /* FALLTHROUGH */
+ case 2: /* Ext method is champion. */
+ method_oload_champ = ext_method_oload_champ;
+ method_badness = ext_method_badness;
+ src_method_oload_champ = -1;
+ method_match_quality = ext_method_match_quality;
+ break;
+ case 3: /* Src method is champion. */
+ method_oload_champ = src_method_oload_champ;
+ method_badness = src_method_badness;
+ ext_method_oload_champ = -1;
+ method_match_quality = src_method_match_quality;
+ break;
+ default:
+ gdb_assert_not_reached ("Unexpected overload comparison "
+ "result");
+ break;
+ }
+ }
+ else if (src_method_oload_champ >= 0)
+ {
+ method_oload_champ = src_method_oload_champ;
+ method_badness = src_method_badness;
+ method_match_quality = src_method_match_quality;
+ }
+ else if (ext_method_oload_champ >= 0)
+ {
+ method_oload_champ = ext_method_oload_champ;
+ method_badness = ext_method_badness;
+ method_match_quality = ext_method_match_quality;
+ }