I am working on source analysis tool using LibTooling which use RecursiveASTVisitor to inspect CXXRecordDecl. This works well but occasionally i am getting 'queried property of class with no definition’ (full error below) while trying to access various CXXRecordDecl properties. I am guessing this because underlying CXXRecordDecl is just a forward declaration (is this correct?) so no records could be accessed.
So to filter such forward declarations i added check that call CXXRecordDecl::hasDefinition() and avoid inspecting records that have no definition. This seems to work but this check filter all ClassTemplateSpecializationDecl instances as well because ClassTemplateSpecializationDecl::hasDefinition() return false even for instances that could be inspected.
Is there is a way i can check if instance of ClassTemplateSpecializationDecl has definition and it properties could be queried?
DeclCXX.h:592: clang::CXXRecordDecl::DefinitionData& clang::CXXRecordDecl::data() const: Assertion `DD && "queried property of class with no definition"