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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 27 07:25:17 PDT 2018


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:
> 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.
> 
> 
> 
> 
Indeed for the current cases it doesn't... there might be some uncaught ones though where it can be useful. But we can add it later as well. So I am thinking to undo this?


https://reviews.llvm.org/D46049





More information about the cfe-commits mailing list