[PATCH] D54258: [Clang] Fix pretty printing of CUDA address spaces

Richard Membarth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 8 06:36:08 PST 2018


richardmembarth created this revision.
richardmembarth added reviewers: Anastasia, aaron.ballman.
Herald added a subscriber: cfe-commits.

The current pretty-printer emits OpenCL-style memory spaces specifiers: __device, __constant, and __shared.
The correct CUDA memory space specifiers are: __device__, __constant__, and __shared__:
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#variable-memory-space-specifiers


Repository:
  rC Clang

https://reviews.llvm.org/D54258

Files:
  lib/AST/TypePrinter.cpp


Index: lib/AST/TypePrinter.cpp
===================================================================
--- lib/AST/TypePrinter.cpp
+++ lib/AST/TypePrinter.cpp
@@ -1738,17 +1738,19 @@
       case LangAS::opencl_private:
         break;
       case LangAS::opencl_constant:
-      case LangAS::cuda_constant:
         OS << "__constant";
         break;
       case LangAS::opencl_generic:
         OS << "__generic";
         break;
       case LangAS::cuda_device:
-        OS << "__device";
+        OS << "__device__";
+        break;
+      case LangAS::cuda_constant:
+        OS << "__constant__";
         break;
       case LangAS::cuda_shared:
-        OS << "__shared";
+        OS << "__shared__";
         break;
       default:
         OS << "__attribute__((address_space(";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54258.173154.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181108/55e1aeb8/attachment.bin>


More information about the cfe-commits mailing list