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

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 27 09:28:57 PDT 2017


Anastasia added inline comments.


================
Comment at: lib/Sema/SemaType.cpp:6808
 
+static void deduceOpenCLImplicitAddrSpace(TypeProcessingState &State,
+                                          QualType &T, TypeAttrLocation TAL) {
----------------
Great! This looks so clear now!


================
Comment at: lib/Sema/SemaType.cpp:6810
+                                          QualType &T, TypeAttrLocation TAL) {
+  if (!State.getSema().getLangOpts().OpenCL ||
+      T.getAddressSpace() != LangAS::Default)
----------------
I think this could be checked before calling the function.


================
Comment at: lib/Sema/SemaType.cpp:6863
+  unsigned ImpAddr;
+  bool IsStatic = D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static;
+  // Put OpenCL automatic variable in private address space.
----------------
Do we cover `extern` too?


================
Comment at: lib/Sema/SemaType.cpp:6872
+      ImpAddr = LangAS::opencl_private;
+    else if (IsStatic)
+      ImpAddr = LangAS::opencl_global;
----------------
I think we can't have this case for CL1.2 see s6.8. But I think it could happen for `extern` though.


https://reviews.llvm.org/D35082





More information about the cfe-commits mailing list