[PATCH] D51341: [HEADER] Overloadable function candidates for half/double types

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 29 06:47:35 PDT 2018

Anastasia added inline comments.

Comment at: lib/Sema/SemaOverload.cpp:6063
+  // OpenCL: A candidate function that uses extentions that are not enabled or
+  // supported is not viable.
+  if (getLangOpts().OpenCL) {
I would imagine if extension isn't supported the candidate function with data type defined by extension shouldn't be available at all during compilation?

Also is there any good way to generalize this for all types and extensions including vendor ones that are added with the pragmas?

Comment at: test/SemaOpenCL/half-double-overload.cl:7
+int __attribute__((overloadable)) goo(float in1, float in2);
+half __attribute__((overloadable)) goo(double in1, double in2);
I think it will be clearer if candidates with non-half parameters moved out of extension enabled block.

Comment at: test/SemaOpenCL/half-double-overload.cl:18
+float __attribute__((overloadable)) foo_err(half in1, half in2);
+// expected-note at -1 {{candidate disabled due to OpenCL extension}}
+float __attribute__((overloadable)) foo_err(half in1, int in2);
Wondering if better message could be:
  candidate unavailable as it requires OpenCL extension to be disabled

Could it also print the extension name?


More information about the cfe-commits mailing list