[cfe-dev] Get template class type from a VarDecl

Albrecht Liebscher via cfe-dev cfe-dev at lists.llvm.org
Tue May 3 06:40:20 PDT 2016


Hi,
I use libclang 3.8 to parse cuda code before it is compiled by the nvidia compiler and tried to ship around the texture type with the following idea:
//---------------------------------------------// I created a texture template classtemplate<typename TData1,typename TData2,typename TData3>class texture{public:    typedef TData1 DataOne;  typedef TData2 DataTwo;  typedef TData3 DataThree;};//and used it this way
texture<float, 1, cudaReadModeElementType> tex;
//----------------------------------------------
Without the class definition clang_visitChildren() will skip the declaration of tex. With class "texture" it finds a CXCursor_ClassTemplate and a CXCursor_VarDecl. In this moment the type of the cursor is CXType_Int.

How can I gather the "texture" type?
Best regards,Albrecht
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160503/3156dd35/attachment.html>


More information about the cfe-dev mailing list