logic: Cxx destructor decl fixes

* omit visiting a type in the name of a CxxDestructorDecl (which recorded a type reference)
* fixed range of names for Cxx destructors and overleaded operators.
This commit is contained in:
mlangkabel
2017-09-11 15:40:26 +02:00
parent 41348f5130
commit 64a97d37f1
5 changed files with 41 additions and 13 deletions
+12 -3
View File
@@ -461,6 +461,12 @@ bool CxxAstVisitor::TraverseBinComma(clang::BinaryOperator* s)
return true;
}
bool CxxAstVisitor::TraverseDeclarationNameInfo(clang::DeclarationNameInfo NameInfo)
{
// we don't visit any children here
return true;
}
void CxxAstVisitor::traverseDeclContextHelper(clang::DeclContext* d)
{
if (!d)
@@ -682,15 +688,18 @@ ParseLocation CxxAstVisitor::getParseLocation(const clang::SourceRange& sourceRa
{
const clang::SourceManager& sourceManager = m_astContext->getSourceManager();
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(sourceRange.getBegin(), false);
const clang::PresumedLoc& presumedEnd = sourceManager.getPresumedLoc(sourceRange.getEnd(), false);
const clang::SourceLocation startLoc = sourceRange.getBegin();
const clang::SourceLocation endLoc = m_preprocessor->getLocForEndOfToken(sourceRange.getEnd());
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(startLoc, false);
const clang::PresumedLoc& presumedEnd = sourceManager.getPresumedLoc(endLoc, false);
parseLocation = ParseLocation(
m_canonicalFilePathCache->getValue(presumedBegin.getFilename()),
presumedBegin.getLine(),
presumedBegin.getColumn(),
presumedEnd.getLine(),
presumedEnd.getColumn()
presumedEnd.getColumn() - 1
);
}
return parseLocation;
@@ -91,6 +91,8 @@ public:
virtual bool TraverseLambdaCapture(clang::LambdaExpr* lambdaExpr, const clang::LambdaCapture* capture, clang::Expr *Init);
virtual bool TraverseBinComma(clang::BinaryOperator* s);
virtual bool TraverseDeclarationNameInfo(clang::DeclarationNameInfo NameInfo);
#define OPERATOR(NAME) virtual bool TraverseBin##NAME##Assign(clang::CompoundAssignOperator *s) { return TraverseAssignCommon(s); }
OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub)
OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or) OPERATOR(Xor)
@@ -230,7 +230,7 @@ void CxxAstVisitorComponentIndexer::visitFunctionDecl(clang::FunctionDecl* d)
m_client->recordSymbol(
getAstVisitor()->getDeclNameCache()->getValue(d),
clang::isa<clang::CXXMethodDecl>(d) ? SYMBOL_METHOD : SYMBOL_FUNCTION,
getParseLocation(d->getLocation()),
getParseLocation(d->getNameInfo().getSourceRange()),
getParseLocationOfFunctionBody(d),
utility::convertAccessSpecifier(d->getAccess()),
utility::isImplicit(d) ? DEFINITION_IMPLICIT : DEFINITION_EXPLICIT