data: Parsing field usage in initialization list
This commit is contained in:
@@ -57,6 +57,11 @@ TokenLocation::LocationType TokenLocation::getType() const
|
||||
void TokenLocation::setType(LocationType type)
|
||||
{
|
||||
m_type = type;
|
||||
|
||||
if (m_other)
|
||||
{
|
||||
m_other->m_type = type;
|
||||
}
|
||||
}
|
||||
|
||||
TokenLocationLine* TokenLocation::getTokenLocationLine() const
|
||||
|
||||
@@ -201,8 +201,20 @@ bool ASTVisitor::VisitCXXConstructorDecl(clang::CXXConstructorDecl* declaration)
|
||||
{
|
||||
if ((*it)->getInit())
|
||||
{
|
||||
clang::CXXCtorInitializer* init = *it;
|
||||
|
||||
if (init->isMemberInitializer())
|
||||
{
|
||||
m_client->onFieldUsageParsed(
|
||||
// getParseLocation(init->getSourceRange()),
|
||||
getParseLocationForNamedDecl(init->getMember(), init->getMemberLocation()),
|
||||
declaration->getQualifiedNameAsString(),
|
||||
init->getMember()->getQualifiedNameAsString()
|
||||
);
|
||||
}
|
||||
|
||||
ASTBodyVisitor bodyVisitor(this, declaration);
|
||||
bodyVisitor.Visit((*it)->getInit());
|
||||
bodyVisitor.Visit(init->getInit());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,10 +350,10 @@ ParseLocation ASTVisitor::getParseLocation(const clang::SourceRange& sourceRange
|
||||
);
|
||||
}
|
||||
|
||||
ParseLocation ASTVisitor::getParseLocationForNamedDecl(clang::NamedDecl* decl) const
|
||||
ParseLocation ASTVisitor::getParseLocationForNamedDecl(clang::NamedDecl* decl, const clang::SourceLocation& loc) const
|
||||
{
|
||||
const clang::SourceManager& sourceManager = m_context->getSourceManager();
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(decl->getLocation());
|
||||
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(loc);
|
||||
|
||||
return ParseLocation(
|
||||
presumedBegin.getFilename(),
|
||||
@@ -352,6 +364,11 @@ ParseLocation ASTVisitor::getParseLocationForNamedDecl(clang::NamedDecl* decl) c
|
||||
);
|
||||
}
|
||||
|
||||
ParseLocation ASTVisitor::getParseLocationForNamedDecl(clang::NamedDecl* decl) const
|
||||
{
|
||||
return getParseLocationForNamedDecl(decl, decl->getLocation());
|
||||
}
|
||||
|
||||
ParseLocation ASTVisitor::getParseLocationOfFunctionBody(clang::FunctionDecl* decl) const
|
||||
{
|
||||
if (decl->hasBody() && decl->isThisDeclarationADefinition())
|
||||
|
||||
@@ -47,6 +47,7 @@ public:
|
||||
private:
|
||||
bool hasValidLocation(const clang::Decl* declaration) const;
|
||||
ParseLocation getParseLocation(const clang::SourceRange& sourceRange) const;
|
||||
ParseLocation getParseLocationForNamedDecl(clang::NamedDecl* decl, const clang::SourceLocation& loc) const;
|
||||
ParseLocation getParseLocationForNamedDecl(clang::NamedDecl* decl) const;
|
||||
ParseLocation getParseLocationOfFunctionBody(clang::FunctionDecl* decl) const;
|
||||
ParseLocation getParseLocationOfRecordBody(clang::CXXRecordDecl* decl) const;
|
||||
|
||||
Reference in New Issue
Block a user