[PATCH] D32248: CodeGen: Cast alloca to expected address space

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 15 13:44:50 PDT 2017


rjmccall added inline comments.


================
Comment at: lib/Sema/SemaDecl.cpp:7210
+      return;
+    }
   }
----------------
err_opencl_function_variable seems like a better diagnostic, at least for opencl_global.  You can fall back on this more general diagnostic for other address spaces.

I think you can just assert here that T.getAddressSpace() != LangAS::opencl_constant instead of checking it.

Thinking about it, it feels like opencl_local should be handled the same way: they shouldn't get here because they don't really have automatic storage duration.  They're much more like a thread-local than an actual local.  However, we can tackle that some other time.


https://reviews.llvm.org/D32248





More information about the cfe-commits mailing list