[PATCH] D95754: [clang] Print 32 candidates on the first failure, with -fshow-overloads=best.

Justin Lebar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 15 08:51:52 PST 2021


jlebar added a comment.

Thank you for your comments, Aaron!



================
Comment at: clang/lib/Sema/Sema.cpp:2310
 
+  S.Diags.noteNumOverloadCandidatesShown(ShownOverloads);
+
----------------
aaronpuchert wrote:
> Why not in the following `if`? I assume we want to show a long list not necessarily once, but only if it comes with the first error?
My intent was to show the long list once, even if it's not the very first error.  My thought process:

All things being equal, it's better to show more information to the user than less.  The problem is, at some point, the amount of information we show becomes overwhelming and spammy.  Particularly problematic are multiline errors, because then you get O(nm) error lines across the whole TU.  We prevent the O(nm) overwhelm by limiting the number of lines a particular error can produce (using the mechanism in question here, or the template backtrace limit, etc), and then also limiting the total number of individual errors before we stop printing those.

With this change, we display the full(ish) error the first time it occurs and then the truncated error every other time.  So in total it's O(n + m) rather than O(nm).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95754/new/

https://reviews.llvm.org/D95754



More information about the cfe-commits mailing list