<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m emailing this list in the hopes that someone might be able to help me. I am currently using libclang to do some very basic reflection of C++. I am creating a translation unit for a header and then visiting all the tree elements using the cursors, in some cases I fall back onto the qualtypes to get the necessary information out. The problem that I’m having right now is that the cursor type libclang return for std::vector (and other std types like std::map ) is incorrect. It looks like libclang can’t identify the type and falls back onto default int as I am getting a type spelling of “int” for fields of type std::vector. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Given the example header file below:<o:p></o:p></p><p class=MsoNormal>#include <vector><o:p></o:p></p><p class=MsoNormal>#include <string><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>namespace SomeNamespace<o:p></o:p></p><p class=MsoNormal>{<o:p></o:p></p><p class=MsoNormal> struct B<o:p></o:p></p><p class=MsoNormal> {<o:p></o:p></p><p class=MsoNormal> std::string m_string;<o:p></o:p></p><p class=MsoNormal> std::vector<float> m_vector;<o:p></o:p></p><p class=MsoNormal> };<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I parse it using clang_parseTranslationUnit2 with the following inputs: <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Args:</b> "-x", "c++", "-std=c++11"<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>Options:</b> CXTranslationUnit_DetailedPreprocessingRecord | CXTranslationUnit_SkipFunctionBodies | CXTranslationUnit_Incomplete;<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Now when visiting the fields for struct B I get:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>CXType_Int for the cursor to m_vector instead of CXtype_Unexposed which is what I would expect.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>but for the std::string member m_string, I get CXType_Unexposed which allows me to visit the field and extract the necessary info. When visiting the field for the string I correctly get the "namespace" then "typeref" cursor types.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am completely out of ideas as to what is going on, why does lib clang fail to understand the std::vector type? I’m pretty sure I must be doing something horribly wrong.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I got latest on the libclang version from github on June 1st, 2015, built for windows x64 using MSVC 2013 toolchain.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Any assistance would be greatly appreciated, thanks in advance, <o:p></o:p></p><p class=MsoNormal>Bobby<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>