[PATCH] D55656: [OpenCL] Address space for default class members

Bevin Hansson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 00:24:00 PST 2018


ebevhan added inline comments.


================
Comment at: lib/AST/ASTContext.cpp:2781
+
+  return getAddrSpaceQualType(NewT, Orig.getAddressSpace());
 }
----------------
rjmccall wrote:
> Anastasia wrote:
> > rjmccall wrote:
> > > You're trying to handle a method qualifier, not a type a functions that are themselves in some non-standard address space, right?  The method qualifier should already be part of `Proto->getExtProtoInfo()`, so if there's an address space qualifier out here, something is very wrong.
> > As far as I understand the new design, we have an address space qualifier on a method and as a part of the function prototype too. Are you saying that we need to make sure the prototype has an address space too?
> The address-space `this` qualifiers are a part of `FunctionProtoType` that's totally independent from the storage of top-level qualifiers that's part of `QualType`.  `Orig.getAddressSpace()` is asking about the top-level qualifiers, not the `this` qualifiers.  Generally, function types should not have top-level qualifiers at all (although of course a member pointer can have both top-level qualifiers and `this` qualifiers, with the former meaning something completely different from the latter).
I suspect the reason there has to be qualifiers on the function type itself is because of the `getType` mistake I mentioned in the previous patch. If the `this` address space qualifiers aren't also on the function type, then `GetThisType` will not produce the correctly qualified type.

If the `getType` in `GetThisType` is changed to `getTypeQualifiers`, then the function type should not need any qualifiers.


Repository:
  rC Clang

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

https://reviews.llvm.org/D55656





More information about the cfe-commits mailing list