[PATCH] D127961: [OpenCL] Reduce emitting candidate notes for builtins
Sven van Haastregt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 27 01:56:18 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG663e47a50f50: [OpenCL] Reduce emitting candidate notes for builtins (authored by svenvh).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127961/new/
https://reviews.llvm.org/D127961
Files:
clang/lib/Sema/SemaOverload.cpp
clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
Index: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
===================================================================
--- clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -171,14 +171,14 @@
// extension is disabled. Test this by counting the number of notes about
// candidate functions.
void test_atomic_double_reporting(volatile __generic atomic_int *a) {
- atomic_init(a);
+ atomic_init(a, a);
// expected-error at -1{{no matching function for call to 'atomic_init'}}
#if defined(NO_FP64)
// Expecting 5 candidates: int, uint, long, ulong, float
- // expected-note at -4 5 {{candidate function not viable: requires 2 arguments, but 1 was provided}}
+ // expected-note at -4 5 {{candidate function not viable: no known conversion}}
#else
// Expecting 6 candidates: int, uint, long, ulong, float, double
- // expected-note at -7 6 {{candidate function not viable: requires 2 arguments, but 1 was provided}}
+ // expected-note at -7 6 {{candidate function not viable: no known conversion}}
#endif
}
@@ -198,7 +198,6 @@
atomic_exchange_explicit(a_int, d, memory_order_seq_cst);
// expected-error at -1{{no matching function for call to 'atomic_exchange_explicit'}}
- // expected-note at -2 + {{candidate function not viable}}
atomic_exchange_explicit(a_int, d, memory_order_seq_cst, memory_scope_work_group);
}
@@ -272,9 +271,7 @@
res = read_imageh(image_read_only_image2d, i2);
#if __OPENCL_C_VERSION__ < CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
// expected-error at -3{{no matching function for call to 'read_imagef'}}
- // expected-note at -4 + {{candidate function not viable}}
- // expected-error at -4{{no matching function for call to 'read_imageh'}}
- // expected-note at -5 + {{candidate function not viable}}
+ // expected-error at -3{{no matching function for call to 'read_imageh'}}
#endif
res = read_imageh(image_read_only_image2d, sampler, i2);
@@ -304,7 +301,6 @@
write_imagef(image3dwo, i4, i, f4);
#if __OPENCL_C_VERSION__ <= CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
// expected-error at -2{{no matching function for call to 'write_imagef'}}
- // expected-note at -3 + {{candidate function not viable}}
#endif
}
Index: clang/lib/Sema/SemaOverload.cpp
===================================================================
--- clang/lib/Sema/SemaOverload.cpp
+++ clang/lib/Sema/SemaOverload.cpp
@@ -11266,6 +11266,13 @@
if (shouldSkipNotingLambdaConversionDecl(Fn))
return;
+ // There is no physical candidate declaration to point to for OpenCL builtins.
+ // Except for failed conversions, the notes are identical for each candidate,
+ // so do not generate such notes.
+ if (S.getLangOpts().OpenCL && Fn->isImplicit() &&
+ Cand->FailureKind != ovl_fail_bad_conversion)
+ return;
+
// Note deleted candidates, but only if they're viable.
if (Cand->Viable) {
if (Fn->isDeleted()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127961.440132.patch
Type: text/x-patch
Size: 2939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220627/e1a15b54/attachment.bin>
More information about the cfe-commits
mailing list