[PATCH] D109874: [OpenCL] Defines helper function for OpenCL default address space
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 21 02:38:41 PDT 2021
Anastasia added inline comments.
================
Comment at: clang/include/clang/AST/ASTContext.h:1366
+ /// Returns default address space based on OpenCL version and enabled features
+ inline LangAS getDefaultOpenCLAddrSpace() {
+ return LangOpts.OpenCLGenericAddressSpace ? LangAS::opencl_generic
----------------
We should probably rename this to `getDefaultPointeeOpenCLAddrSpace` because this only reflects the default address space for the pointer types.
================
Comment at: clang/lib/AST/Expr.cpp:3782
// since it cannot be assigned to a pointer to constant address space.
- if ((Ctx.getLangOpts().OpenCLVersion >= 200 &&
- Pointee.getAddressSpace() == LangAS::opencl_generic) ||
- (Ctx.getLangOpts().OpenCL &&
- Ctx.getLangOpts().OpenCLVersion < 200 &&
- Pointee.getAddressSpace() == LangAS::opencl_private))
+ if (Pointee.getAddressSpace() == Ctx.getDefaultOpenCLAddrSpace())
Qs.removeAddressSpace();
----------------
Let's add `Ctx.getLangOpts().OpenCL` check at the start to make sure this only runs for OpenCL.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109874/new/
https://reviews.llvm.org/D109874
More information about the cfe-commits
mailing list