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())


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())
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to