================
@@ -15798,6 +15770,20 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, 
SourceLocation StartLoc,
     T = Context.getLifetimeQualifiedType(T, lifetime);
   }
 
+  if (getLangOpts().OpenCL) {
+    assert(!isa<DecayedType>(T));
+    if (T->isArrayType() && !T.hasAddressSpace()) {
+      QualType ET = Context.getAsArrayType(T)->getElementType();
+      if (!ET.hasAddressSpace()) {
+        // Add the private address space to the contents of the pointer when a
+        // pointer parameter is declared as an array and not declared.
+        LangAS ImplAS = LangAS::opencl_private;
----------------
vtjnash wrote:

I'm fairly sure it should not have been defined this way, since `x[]` is 
supposed to be syntax sugar here for `x*`, but nothing I can do about that now: 
OpenCL instead defined that `f(int x[])` means `f(__local int *x)`. Changing 
that would seem likely a breaking change now (I would simply hope here to 
discourage other targets from making the same choice here)

https://github.com/llvm/llvm-project/pull/184264
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to