r215208 - Expose the CUDA shared attribute to the C API.
Eli Bendersky
eliben at google.com
Fri Aug 8 07:59:01 PDT 2014
Author: eliben
Date: Fri Aug 8 09:59:00 2014
New Revision: 215208
URL: http://llvm.org/viewvc/llvm-project?rev=215208&view=rev
Log:
Expose the CUDA shared attribute to the C API.
Similar to r209767, which exposed other CUDA-related attributes.
Patch by Rob Springer.
Modified:
cfe/trunk/bindings/python/clang/cindex.py
cfe/trunk/include/clang-c/Index.h
cfe/trunk/test/Index/attributes-cuda.cu
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/CXCursor.cpp
Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=215208&r1=215207&r2=215208&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Fri Aug 8 09:59:00 2014
@@ -1086,6 +1086,7 @@ CursorKind.CUDACONSTANT_ATTR = CursorKin
CursorKind.CUDADEVICE_ATTR = CursorKind(413)
CursorKind.CUDAGLOBAL_ATTR = CursorKind(414)
CursorKind.CUDAHOST_ATTR = CursorKind(415)
+CursorKind.CUDASHARED_ATTR = CursorKind(416)
###
# Preprocessing
Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=215208&r1=215207&r2=215208&view=diff
==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Fri Aug 8 09:59:00 2014
@@ -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,
Modified: cfe/trunk/test/Index/attributes-cuda.cu
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/attributes-cuda.cu?rev=215208&r1=215207&r2=215208&view=diff
==============================================================================
--- cfe/trunk/test/Index/attributes-cuda.cu (original)
+++ cfe/trunk/test/Index/attributes-cuda.cu Fri Aug 8 09:59:00 2014
@@ -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)
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=215208&r1=215207&r2=215208&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Aug 8 09:59:00 2014
@@ -4052,6 +4052,8 @@ CXString clang_getCursorKindSpelling(enu
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:
Modified: cfe/trunk/tools/libclang/CXCursor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXCursor.cpp?rev=215208&r1=215207&r2=215208&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXCursor.cpp (original)
+++ cfe/trunk/tools/libclang/CXCursor.cpp Fri Aug 8 09:59:00 2014
@@ -57,6 +57,7 @@ static CXCursorKind GetCursorKind(const
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;
More information about the cfe-commits
mailing list