data: Parsing type usages within function and method bodies
This change parses type usages in function and method bodies and saves them with an edge of type EDGE_TYPE_USAGE. This also includes base class types used in initialization lists of derived class constructors.
This commit is contained in:
@@ -206,6 +206,13 @@ bool ASTVisitor::VisitCXXConstructorDecl(clang::CXXConstructorDecl* declaration)
|
||||
init->getMember()->getQualifiedNameAsString()
|
||||
);
|
||||
}
|
||||
else if (init->isBaseInitializer())
|
||||
{
|
||||
m_client->onTypeUsageParsed(
|
||||
getParseTypeUsage(init->getTypeSourceInfo()->getTypeLoc(), init->getTypeSourceInfo()->getType()),
|
||||
getParseFunction(declaration)
|
||||
);
|
||||
}
|
||||
|
||||
ASTBodyVisitor bodyVisitor(this, declaration);
|
||||
bodyVisitor.Visit(init->getInit());
|
||||
@@ -308,7 +315,7 @@ void ASTVisitor::VisitCXXConstructExprInDeclBody(clang::VarDecl* decl, clang::CX
|
||||
);
|
||||
}
|
||||
|
||||
void ASTVisitor::VisitFieldUsageExprInDeclBody(clang::FunctionDecl* decl, clang::MemberExpr* expr)
|
||||
void ASTVisitor::VisitMemberExprInDeclBody(clang::FunctionDecl* decl, clang::MemberExpr* expr)
|
||||
{
|
||||
ParseLocation parseLocation = getParseLocation(expr->getSourceRange());
|
||||
|
||||
@@ -322,7 +329,7 @@ void ASTVisitor::VisitFieldUsageExprInDeclBody(clang::FunctionDecl* decl, clang:
|
||||
);
|
||||
}
|
||||
|
||||
void ASTVisitor::VisitGlobalVariableUsageExprInDeclBody(clang::FunctionDecl* decl, clang::DeclRefExpr* expr)
|
||||
void ASTVisitor::VisitDeclRefExprInDeclBody(clang::FunctionDecl* decl, clang::DeclRefExpr* expr)
|
||||
{
|
||||
ParseLocation parseLocation = getParseLocation(expr->getSourceRange());
|
||||
|
||||
@@ -336,6 +343,14 @@ void ASTVisitor::VisitGlobalVariableUsageExprInDeclBody(clang::FunctionDecl* dec
|
||||
);
|
||||
}
|
||||
|
||||
void ASTVisitor::VisitVarDeclInDeclBody(clang::FunctionDecl* decl, clang::VarDecl* varDecl)
|
||||
{
|
||||
m_client->onTypeUsageParsed(
|
||||
getParseTypeUsage(varDecl->getTypeSourceInfo()->getTypeLoc(), varDecl->getType()),
|
||||
getParseFunction(decl)
|
||||
);
|
||||
}
|
||||
|
||||
bool ASTVisitor::hasValidLocation(const clang::Decl* declaration) const
|
||||
{
|
||||
const clang::SourceLocation& location = declaration->getLocStart();
|
||||
|
||||
Reference in New Issue
Block a user