[PATCH] D96051: [OpenCL] Support enum and typedef args in TableGen BIFs

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 16 04:47:09 PST 2021


Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!



================
Comment at: clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl:27
+  // expected-error at -3 0+{{no matching function for call to 'barrier'}}
+  // expected-error@* {{typedef type cl_mem_fence_flags not found; include the base header with -finclude-default-header}}
+}
----------------
svenvh wrote:
> Anastasia wrote:
> > Actually, could we remove the `typedef` from the diagnostic because it exposes the implementation details unnecessarily? I believe the spec doesn't say what the type is aside from enums?  As a matter of fact, we have some types implemented as typedefs that should have been a native types e.g. vector types that we might change one day.
> I agree it's an implementation detail, but I can see reasons for keeping it: when there is an enum type with the same name available in the translation unit, then the message "type X not found" is not completely correct, because a type X exists, but it is of the wrong type. By prefixing "enum" or "typedef", the diagnostic is more accurate.  This diagnostic is mainly targeted at Clang developers actually, because a user shouldn't see this diagnostic in any normal use case (with the driver setting both -fdeclare-opencl-builtins and -finclude-default-header).
Ah, I see.  Since the diagnostics are not going to be exposed during normal compilation it is less critical indeed... I guess the only issue is when we update the type implementation we might need more tests to change.


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

https://reviews.llvm.org/D96051



More information about the cfe-commits mailing list