Anastasia added inline comments.

================
Comment at: lib/AST/Expr.cpp:870
+  if (C.getLangOpts().OpenCL && Ty.getAddressSpace() == LangAS::Default)
+    Ty = C.getAddrSpaceQualType(Ty, LangAS::opencl_constant);
+
----------------
bader wrote:
> As `Ty` is passed by value, shouldn't we accept only data located in constant 
> address space?
Do you mean to assert? Currently it should be passed with `constant` AS but I 
thought the idea is to modify this function so we can accept `Default` AS too 
but then replace by `constant`.



================
Comment at: lib/Sema/SemaExpr.cpp:3057
+        ResTy = Context.getAddrSpaceQualType(ResTy, LangAS::opencl_constant);
       ResTy = Context.getConstantArrayType(ResTy, LengthI, ArrayType::Normal,
                                            /*IndexTypeQuals*/ 0);
----------------
bader wrote:
> String type can only be a constant arrays.
> Can we set constant address space inside this getter for OpenCL language?
> Or we might want constant array in other address spaces e.g. private? 
Yes, I think we need to be able to declare const arrays in different ASes. I.e. 
this is valid code in OpenCL:
  __private const int* a = ...;

Quick check for `getConstantArrayType`, it seems to be used in many different 
place. So I don't think I can just modify it.


https://reviews.llvm.org/D46049



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to