[PATCH] D60454: [OpenCL] Prevent mangling kernel functions

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 02:39:31 PDT 2019


Anastasia added a comment.

In D60454#1488348 <https://reviews.llvm.org/D60454#1488348>, @rjmccall wrote:

> I think it would be more reasonable to just change `getDeclLanguageLinkage` to check for a kernel function.


I tried to change `getDeclLanguageLinkage` only but Sema calls `isInExternCContext` separately while giving diagnostics. `getDeclLanguageLinkage` also calls it through `isFirstInExternCContext`. So it seems we just need to check in `isInExternCContext` and that is a common part for all various program paths. Do you agree?



================
Comment at: lib/AST/Decl.cpp:2940
+  if (hasAttr<OpenCLKernelAttr>())
+    return true;
   return isDeclExternC(*this);
----------------
rjmccall wrote:
> Both of these changes should be unnecessary because they ultimately defer to `isInExternCContext`.
> 
> I assume that OpenCL bans making a class member function a kernel?
> I assume that OpenCL bans making a class member function a kernel?

Yep, that's right! I am adding a diagnostic in this patch.


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

https://reviews.llvm.org/D60454





More information about the cfe-commits mailing list