[PATCH] D38857: [OpenCL] Improve printing and semantic check related to implicit addr space

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 23 00:30:49 PDT 2017


rjmccall added inline comments.


================
Comment at: include/clang/AST/Type.h:337
+    Mask = (Mask & ~ImplicitAddrSpaceMask) |
+           (((uint32_t)Value) << ImplicitAddrSpaceShift);
+  }
----------------
This is probably cleaner as:

  Mask = (Value ? (Mask | ImplicitAddrSpaceMask) : (Mask & ~ImplicitAddrSpaceMask));


================
Comment at: lib/AST/ASTContext.cpp:2290
+  if (CanT.getAddressSpace() == AddressSpace &&
+      CanT.getQualifiers().isAddressSpaceImplicit() == ImplicitFlag)
     return T;
----------------
It looks like your changes here are making implicitness part of the canonical type, which is wrong, because implicitly- and explicitly-qualified types are not actually different types.

That is fixable, but I'm going to ask you to investigate whether you can solve this problem with AttributedType before you introduce this complexity into the qualifier system.


https://reviews.llvm.org/D38857





More information about the cfe-commits mailing list