[PATCH] D35082: [OpenCL] Add LangAS::opencl_private to represent private address space in AST

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 8 03:35:01 PDT 2017


yaxunl marked 6 inline comments as done.
yaxunl added inline comments.


================
Comment at: include/clang/AST/Type.h:332
 
+  bool getImplicitAddressSpaceFlag() const { return Mask & IMask; }
+  void setImplicitAddressSpaceFlag(bool Value) {
----------------
Anastasia wrote:
> Could we add a bit of comment somewhere explaining why we added implicit AS flag please.
Will do.


================
Comment at: lib/AST/Expr.cpp:3254
+        // Only (void*)0 or equivalent are treated as nullptr. If pointee type
+        // has non-default address space it is not treated as nullptr.
+        bool PointeeHasDefaultAS = false;
----------------
Anastasia wrote:
> Is this comment right wrt to named address spaces. So is `(private void*)0` not a `nullptr`?
Yes this will be true.

Neither (private void*)0 nor (__generic void*)0 should be treated nullptr since they cannot be assigned to a constant pointer.

This need some change below to check implicity of the address space. I will do that. Also add more tests about this.


================
Comment at: lib/Sema/SemaType.cpp:6994
+      // OpenCL v1.2 s6.5:
+      // The generic address space name for arguments to a function in a
+      // program, or local variables of a function is __private. All function
----------------
Anastasia wrote:
> The generic address space -> The default address space
'The generic address space name for arguments' is literally from the OpenCL 1.2 spec. Note it refers 'generic address space name', which is not the 'generic address space' defined by OpenCL 2.0 spec.


https://reviews.llvm.org/D35082





More information about the cfe-commits mailing list