Helper function getDefaultPointeeOpenCLAddrSpace() introduced to
ASTContext class. It returns default OpenCL address space
depending on language version and enabled features. If generic
address space is supported, the helper function returns value
LangAS::opencl_generic. Otherwise, value LangAS::opencl_private
is returned. Code refactoring changes performed in several suitable
places.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Current change is an initial draft. More code refactoring will be performed and change summary provided in near future.
clang/include/clang/AST/ASTContext.h | ||
---|---|---|
1366 | We should probably rename this to getDefaultPointeeOpenCLAddrSpace because this only reflects the default address space for the pointer types. | |
clang/lib/AST/Expr.cpp | ||
3782–3783 | Let's add Ctx.getLangOpts().OpenCL check at the start to make sure this only runs for OpenCL. |
Helper function renamed for clarity. Additional check added to if statement to ensure it is only carried out in OpenCL.
Both comments addressed. Personally, I would shuffle words around to rename helper function as getDefaultOpenCLPointeeAddrSpace or getOpenCLDefaultPointeeAddrSpace. Although I am not sure if there are some assumed naming conventions in Clang. Originally, I was following the name of getDefaultCXXMethodAddrSpace.
LGTM! Thanks
Feel free to adjust the naming scheme either in the same commit or separately.
We should probably rename this to getDefaultPointeeOpenCLAddrSpace because this only reflects the default address space for the pointer types.