summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-08-08 14:59:00 +0000
committerEli Bendersky <eliben@google.com>2014-08-08 14:59:00 +0000
commit22a11d21891eeed1b5d9a936014e3dae69bb2399 (patch)
treea6a3c2cc87ed9ea5a8baff8b19b26d802e064b5b
parentd6d04866e139d22996e0a2f6df97ae31d88006c7 (diff)
Expose the CUDA shared attribute to the C API.
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
-rw-r--r--bindings/python/clang/cindex.py1
-rw-r--r--include/clang-c/Index.h3
-rw-r--r--test/Index/attributes-cuda.cu7
-rw-r--r--tools/libclang/CIndex.cpp2
-rw-r--r--tools/libclang/CXCursor.cpp1
5 files changed, 11 insertions, 3 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py
index ebe28fb08a..68f7e48fc6 100644
--- a/bindings/python/clang/cindex.py
+++ b/bindings/python/clang/cindex.py
@@ -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
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index 972f42e69a..15ccc3b208 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -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,
diff --git a/test/Index/attributes-cuda.cu b/test/Index/attributes-cuda.cu
index 953ef3d51f..824bdb4c88 100644
--- a/test/Index/attributes-cuda.cu
+++ b/test/Index/attributes-cuda.cu
@@ -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)
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index d898f90ca6..f1886e0735 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -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:
diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp
index a20cc4ad3d..db31008790 100644
--- a/tools/libclang/CXCursor.cpp
+++ b/tools/libclang/CXCursor.cpp
@@ -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;