This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL][PR49264] Allow taking address of functions by enabling the extension
ClosedPublic

Authored by Anastasia on Feb 22 2021, 9:15 AM.

Details

Summary

When __cl_clang_function_pointers extension is enabled clang should allow obtaining the function address.

FYI, taking function addresses is not disallowed by OpenCL C. It is not clear why exactly this diagnostic was introduced, potentially it was trying to prevent from writing incorrect code, but however, the address of the function can be taken without calling the function. Potentially in the future, this should be changed to a warning or perhaps even removed.

Note that allowing this feature fully triggered some issues (PR49315) that got revealed in OpenCL C but not C++ for OpenCL. However, any further issues will be addressed separately.

Diff Detail

Event Timeline

Anastasia created this revision.Feb 22 2021, 9:15 AM
Anastasia requested review of this revision.Feb 22 2021, 9:15 AM
Anastasia updated this revision to Diff 325729.Feb 23 2021, 3:40 AM

Uploaded full diff

mantognini accepted this revision.Feb 23 2021, 7:06 AM

looks appropriate to me.

This revision is now accepted and ready to land.Feb 23 2021, 7:06 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 24 2021, 4:32 AM