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

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 27 06:14:11 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);
+
----------------
Anastasia wrote:
> 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`.
> 
Yes, but according to your other comment this idea doesn't work.

> I have added the address space to the creation of StringLiteral, but unfortunately it doesn't seems like we can remove similar code in other places because **QualType created for StringLiteral is also used elsewhere and has to match (contain right address space).** I.e. here is it used further down to create PredefinedExpr.






https://reviews.llvm.org/D46049





More information about the cfe-commits mailing list