// dump all our output in one write call - this is to try and limit IO "crosstalk" between multiple processes // writing to the same logfile
std::string output; for (const std::string& s : overriddenSet)
output += "overridden:\t" + s + "\n"; for (constauto& s : definitionMap)
output += "definition:\t" + s.first + "\t" + s.second + "\n";
std::ofstream myfile;
myfile.open(WORKDIR "/loplugin.finalmethods.log", std::ios::app | std::ios::out);
myfile << output;
myfile.close();
}
bool FinalMethods::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
{ if (ignoreLocation(methodDecl)) returntrue; if (!methodDecl->isThisDeclarationADefinition()) returntrue; // don't care about compiler-generated functions if (methodDecl->isImplicit()) returntrue; if (!methodDecl->isVirtual()) returntrue; if (!methodDecl->getLocation().isValid()) returntrue; if (isa<CXXDestructorDecl>(methodDecl) || isa<CXXConstructorDecl>(methodDecl)) returntrue;
methodDecl = methodDecl->getCanonicalDecl(); if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(methodDecl->getLocation()))) returntrue;
// If the containing class/struct is final, then the method is effectively final too. if (!methodDecl->hasAttr<FinalAttr>() && !methodDecl->getParent()->hasAttr<FinalAttr>())
definitionMap.insert({ methodNiceName, toString(methodDecl->getBeginLoc()) });
for (auto it = methodDecl->begin_overridden_methods();
it != methodDecl->end_overridden_methods(); ++it)
overriddenSet.insert(niceName(*it));
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.