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

Dmitry Sidorov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 6 01:52:42 PDT 2018


sidorovd marked an inline comment as done.
sidorovd 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) {
----------------
Anastasia wrote:
> 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?
> https://clang.llvm.org/docs/UsersManual.html#opencl-extensions
> 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?

Yes, you are right.

> Also is there any good way to generalize this for all types and extensions including vendor ones that are added with the pragmas?
https://clang.llvm.org/docs/UsersManual.html#opencl-extensions

There might be a way but I can't properly answer this question right now. By default types and extensions aren't associated to each other.


================
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);
----------------
Anastasia wrote:
> Wondering if better message could be:
>   candidate unavailable as it requires OpenCL extension to be disabled
> 
> Could it also print the extension name?
Sounds good. And I'd prefer to split it into another patch, because it would affect unrelated to the change tests and also require changes in Sema to allow extension name printing. 


https://reviews.llvm.org/D51341





More information about the cfe-commits mailing list