[PATCH] D32977: [OpenCL] Emit function-scope variable in constant address space as static variable

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 9 15:23:32 PDT 2017


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:7129
+        NewVD->getType().getAddressSpace() != LangAS::opencl_constant) ||
         NewVD->hasExternalStorage()) {
       if (!T->isSamplerT() &&
----------------
Seeing criteria like this, and a lot of the other things you've modified, makes me feel like we should just have a VarDecl::getStorageDuration().


================
Comment at: lib/Sema/SemaDecl.cpp:10286
+          // these variables must be a compile time constant.
+          VDecl->getType().getAddressSpace() == LangAS::opencl_constant)
         CheckForConstantInitializer(Init, DclT);
----------------
Should this rule apply even in C++ mode?  I can't remember if there are any OpenCL/C++ hybrids.


https://reviews.llvm.org/D32977





More information about the cfe-commits mailing list