[PATCH] D82781: [OpenCL] Fix missing address space deduction in template variables

Ole Strohm via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 06:58:19 PDT 2020


olestrohm updated this revision to Diff 275381.
olestrohm added a comment.

I have added a check in `deduceOpenCLAddressSpace()` to check if the type is dependent, and not deduce the address space if it is. This is a big change in the behaviour of address space deduction, meaning that template variables only receive address spaces when they are being specialized. This is good, but caused a lot of changes in the current test file, which has been included in this patch.

There also had to be added a check for dependent types in CheckVariableDeclarationType when checking whether global variables have the correct address space. With this new change dependent types don't necessarily have address spaces yet, and thus then lets it pass until the variable declaration of the specialized template variable is checked later.


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

https://reviews.llvm.org/D82781

Files:
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/SemaOpenCLCXX/address-space-deduction.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82781.275381.patch
Type: text/x-patch
Size: 4559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200703/0e9d43cb/attachment.bin>


More information about the cfe-commits mailing list