[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 03:45:01 PDT 2020
olestrohm updated this revision to Diff 275345.
olestrohm added a comment.
Added a guard in deduceOpenCLAddressSpace to stop it from deducing address space for dependent types, as requested.
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
Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -3630,7 +3630,7 @@
// in every situation.
// This approach was copied from TemplateDeclInstantiator::VisitVarDecl
if (SemaRef.getLangOpts().OpenCL)
- SemaRef.deduceOpenCLAddressSpace(Var);
+ SemaRef.deduceOpenCLAddressSpace(Var);
// Substitute the nested name specifier, if any.
if (SubstQualifier(D, Var))
@@ -4815,7 +4815,7 @@
// reliable in every situation.
// This approach was copied from TemplateDeclInstantiator::VisitVarDecl
if (getLangOpts().OpenCL)
- deduceOpenCLAddressSpace(VarSpec);
+ deduceOpenCLAddressSpace(VarSpec);
return VarSpec;
}
Index: clang/lib/Sema/SemaDecl.cpp
===================================================================
--- clang/lib/Sema/SemaDecl.cpp
+++ clang/lib/Sema/SemaDecl.cpp
@@ -6287,6 +6287,8 @@
void Sema::deduceOpenCLAddressSpace(ValueDecl *Decl) {
if (Decl->getType().hasAddressSpace())
return;
+ if (Decl->getType().isDependentType())
+ return;
if (VarDecl *Var = dyn_cast<VarDecl>(Decl)) {
QualType Type = Var->getType();
if (Type->isSamplerT() || Type->isVoidType())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82781.275345.patch
Type: text/x-patch
Size: 1316 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200703/6c28ce4c/attachment.bin>
More information about the cfe-commits
mailing list