[PATCH] D46049: [OpenCL] Add constant address space to __func__ in AST

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 26 13:43:48 PDT 2018


bader 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);
+
----------------
As `Ty` is passed by value, shouldn't we accept only data located in constant address space?


================
Comment at: lib/Sema/SemaExpr.cpp:3057
+        ResTy = Context.getAddrSpaceQualType(ResTy, LangAS::opencl_constant);
       ResTy = Context.getConstantArrayType(ResTy, LengthI, ArrayType::Normal,
                                            /*IndexTypeQuals*/ 0);
----------------
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? 


https://reviews.llvm.org/D46049





More information about the cfe-commits mailing list