[PATCH] D55850: [OpenCL] Allow address spaces as method qualifiers

Bruno De Fraine via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 15 03:24:44 PST 2019


brunodf added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:4877
           T = Context.getFunctionType(T, ParamTys, EPI);
           T = state.getSema().Context.getAddrSpaceQualType(T, AS);
         } else {
----------------
I follow all of the above (from the point "a class member function has an address space"), but then I take issue with this line (already from Mikael).

You look at the declaration's attributes, to derive the ASIdx relating to the method's this argument. You mark the relevant attributes as invalid, to prevent them from being considered in "processTypeAttrs" after the switch that we break below. The ASIdx is stored in the qualifiers EPI to go to the FunctionProtoType (this will affect getThisType). This all seems fine.

But then this line adds the address space qualification to T, the type of the declared function itself. This seems unnecessary, and conceptually wrong: while the function may have an address space in syntax, this address space applies to the this argument, not to the function object (and a pointer to the function is not a pointer to this address space etc.). In short, I think this line should be removed.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55850/new/

https://reviews.llvm.org/D55850





More information about the cfe-commits mailing list