I am using the high-level API in clang-c, and using the
clang_indexSourceFile() to traverse the code. In the indexDeclaration
callback function, I can access the the CXIdxDeclInfo of the
cb.indexDeclaration = (CXClientData, const CXIdxDeclInfo *decl)
if (auto class_ = ::clang_index_getCXXClassDeclInfo(decl))
// access class_->bases[i] as CIdxBaseClassInfo
My question is, given a CIdxBaseClassInfo pointer, how can I turn it
into CIdxDeclInfo and call clang_index_getCXXClassDeclInfo() again?
If the base class is not an instantiation of a template, it should be
visited by indexDeclaration() before. However template instantiated
classes are not visited (even if I pass
clang_indexSourceFile(). I can't find a way to get a CXIdxDeclInfo
pointer to these template instantiated classes.
Attached is the test program I used. My goal is to get a pointer to
CXIdxDeclInfo to "RecursiveBase<Base>" and deduce the class hierarchy: