[PATCH] D127961: [OpenCL] Reduce emitting candidate notes for builtins
Sven van Haastregt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 17 04:03:17 PDT 2022
svenvh added inline comments.
================
Comment at: clang/lib/Sema/SemaOverload.cpp:11224
+ // so do not generate such notes.
+ if (S.getLangOpts().OpenCL && Fn->isImplicit() &&
+ Cand->FailureKind != ovl_fail_bad_conversion)
----------------
Anastasia wrote:
> It would have been nice to print each of those overloads but my guess is that it's too much work?
It's not trivial to print those overloads because we don't have a real source declaration, but even if it was trivial I am not sure if there is much value in printing all overloads. Typically there are a lot of overloads for OpenCL builtins, partly because of all the vector versions. I don't think a user will get much value out of screens full of overloads that didn't match.
For example, for the following code
```
int i, j, k;
i = max(i, j, k);
```
without this patch clang produces 121 note diagnostics. If we manage to fit the diagnostic and candidate on a single line (which I doubt we can, normally they take 3 lines each), a user will still have to scroll through a few screens (on a 50-line terminal) of note diagnostics before reaching the actual error diagnostic.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127961/new/
https://reviews.llvm.org/D127961
More information about the cfe-commits
mailing list