bool VirtualDown::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
{ if (ignoreLocation(methodDecl))
{ returntrue;
} if (!methodDecl->isThisDeclarationADefinition() || !methodDecl->isVirtual()
|| methodDecl->isDeleted())
{ returntrue;
}
methodDecl = methodDecl->getCanonicalDecl(); // ignore stuff that forms part of the stable URE interface if (isInUnoIncludeFile(methodDecl))
{ returntrue;
}
std::string aNiceName = niceName(methodDecl);
if (isa<CXXDestructorDecl>(methodDecl)) returntrue; if (isa<CXXConstructorDecl>(methodDecl)) returntrue;
if (methodDecl->size_overridden_methods() == 0)
definitionSet.insert({ aNiceName, toString(methodDecl->getLocation()) });
returntrue;
}
bool VirtualDown::VisitCXXMemberCallExpr(CXXMemberCallExpr const* expr)
{ // Note that I don't ignore ANYTHING here, because I want to get calls to my code that result // from template instantiation deep inside the STL and other external code
FunctionDecl const* calleeFunctionDecl = expr->getDirectCallee(); if (calleeFunctionDecl == nullptr)
{
Expr const* callee = expr->getCallee()->IgnoreParenImpCasts();
DeclRefExpr const* dr = dyn_cast<DeclRefExpr>(callee); if (dr)
{
calleeFunctionDecl = dyn_cast<FunctionDecl>(dr->getDecl()); if (calleeFunctionDecl) goto gotfunc;
} returntrue;
}
gotfunc:
// ignore recursive calls if (currentFunctionDecl == calleeFunctionDecl) returntrue;
auto cxxMethodDecl = dyn_cast<CXXMethodDecl>(calleeFunctionDecl); if (!cxxMethodDecl) returntrue;
while (cxxMethodDecl->getTemplateInstantiationPattern())
cxxMethodDecl = dyn_cast<CXXMethodDecl>(cxxMethodDecl->getTemplateInstantiationPattern()); while (cxxMethodDecl->getInstantiatedFromMemberFunction())
cxxMethodDecl = dyn_cast<CXXMethodDecl>(cxxMethodDecl->getInstantiatedFromMemberFunction()); if (cxxMethodDecl->getLocation().isValid() && !ignoreLocation(cxxMethodDecl))
callSet.insert(niceName(cxxMethodDecl));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.