I have used AST matchers in Clang's libTooling and given a QualType, I can get the pointer type from the ASTContext using the following function:
QualType getPointerType(QualType T) const;
Now I am trying to do something with clang-c and I have a visitor in which I can get CXType from a cursor. But how do I get a pointer type from that CXType?
I can do this to get a canonical type:
CXType Type = clang_getCursorType(Cursor);
CXType Canonical = clang_getCanonicalType(Type);
A bit more hackish attempt would be to get the QualType from CXType (and TU if needed):
QualType QType = QualType::getFromOpaquePtr(Type.data[0]);
CXTranslationUnit TU = static_cast<CXTranslationUnit>(Type.data[1]);
However, even if I do get the QualType, I still can't get the pointer type because I don't have ASTContext in the visitor. And I don't see an equivalent to getPointerType(T). Am I missing something obvious, or the C API is simply missing clang_getPointerType(T)?