[cfe-dev] hasDefinition() is false for ClassTemplateSpecializationDecl instances

Sergey Lyskov via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 17 16:16:20 PDT 2016


Dear Developers,

	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?

	Thanks,

Sergey. 

DeclCXX.h:592: clang::CXXRecordDecl::DefinitionData& clang::CXXRecordDecl::data() const: Assertion `DD && "queried property of class with no definition"

	


More information about the cfe-dev mailing list