]> granicus.if.org Git - clang/commitdiff
Expose the CUDA shared attribute to the C API.
authorEli Bendersky <eliben@google.com>
Fri, 8 Aug 2014 14:59:00 +0000 (14:59 +0000)
committerEli Bendersky <eliben@google.com>
Fri, 8 Aug 2014 14:59:00 +0000 (14:59 +0000)
Similar to r209767, which exposed other CUDA-related attributes.

Patch by Rob Springer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215208 91177308-0d34-0410-b5e6-96231b3b80d8

bindings/python/clang/cindex.py
include/clang-c/Index.h
test/Index/attributes-cuda.cu
tools/libclang/CIndex.cpp
tools/libclang/CXCursor.cpp

index ebe28fb08a44f7d12965fb6d9b9f979d337c8ae5..68f7e48fc66337c0839c30bb3695b13973ac13a2 100644 (file)
@@ -1086,6 +1086,7 @@ CursorKind.CUDACONSTANT_ATTR = CursorKind(412)
 CursorKind.CUDADEVICE_ATTR = CursorKind(413)
 CursorKind.CUDAGLOBAL_ATTR = CursorKind(414)
 CursorKind.CUDAHOST_ATTR = CursorKind(415)
+CursorKind.CUDASHARED_ATTR = CursorKind(416)
 
 ###
 # Preprocessing
index 972f42e69a4bbff425e63dbad1e84fd809d13c3a..15ccc3b2088d4c0cca2c8302bc50f425cd49bec1 100644 (file)
@@ -2236,7 +2236,8 @@ enum CXCursorKind {
   CXCursor_CUDADeviceAttr                = 413,
   CXCursor_CUDAGlobalAttr                = 414,
   CXCursor_CUDAHostAttr                  = 415,
-  CXCursor_LastAttr                      = CXCursor_CUDAHostAttr,
+  CXCursor_CUDASharedAttr                = 416,
+  CXCursor_LastAttr                      = CXCursor_CUDASharedAttr,
 
   /* Preprocessing */
   CXCursor_PreprocessingDirective        = 500,
index 953ef3d51fee23f5680a2b49f955a7d1103cef89..824bdb4c883fc4658f27819bfedc6171d8e1a5b1 100644 (file)
@@ -3,6 +3,7 @@
 __attribute__((device)) void f_device();
 __attribute__((global)) void f_global();
 __attribute__((constant)) int* g_constant;
+__attribute__((shared)) float *g_shared;
 __attribute__((host)) void f_host();
 
 // CHECK:       attributes-cuda.cu:3:30: FunctionDecl=f_device:3:30
@@ -11,5 +12,7 @@ __attribute__((host)) void f_host();
 // CHECK-NEXT:  attributes-cuda.cu:4:16: attribute(global)
 // CHECK:       attributes-cuda.cu:5:32: VarDecl=g_constant:5:32 (Definition)
 // CHECK-NEXT:  attributes-cuda.cu:5:16: attribute(constant)
-// CHECK:       attributes-cuda.cu:6:28: FunctionDecl=f_host:6:28
-// CHECK-NEXT:  attributes-cuda.cu:6:16: attribute(host)
+// CHECK:       attributes-cuda.cu:6:32: VarDecl=g_shared:6:32 (Definition)
+// CHECK-NEXT:  attributes-cuda.cu:6:16: attribute(shared)
+// CHECK:       attributes-cuda.cu:7:28: FunctionDecl=f_host:7:28
+// CHECK-NEXT:  attributes-cuda.cu:7:16: attribute(host)
index d898f90ca6284c88bad7bd65a4c342452446dbfb..f1886e0735bb63f02e7d887acbe35aa8edec304e 100644 (file)
@@ -4052,6 +4052,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
     return cxstring::createRef("attribute(global)");
   case CXCursor_CUDAHostAttr:
     return cxstring::createRef("attribute(host)");
+  case CXCursor_CUDASharedAttr:
+    return cxstring::createRef("attribute(shared)");
   case CXCursor_PreprocessingDirective:
     return cxstring::createRef("preprocessing directive");
   case CXCursor_MacroDefinition:
index a20cc4ad3d005f7781cfe56fd8541fa22b4d593c..db310087902519feb6bd61ed78499d17871875f8 100644 (file)
@@ -57,6 +57,7 @@ static CXCursorKind GetCursorKind(const Attr *A) {
     case attr::CUDADevice: return CXCursor_CUDADeviceAttr;
     case attr::CUDAGlobal: return CXCursor_CUDAGlobalAttr;
     case attr::CUDAHost: return CXCursor_CUDAHostAttr;
+    case attr::CUDAShared: return CXCursor_CUDASharedAttr;
   }
 
   return CXCursor_UnexposedAttr;