/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
for (constauto& varLoc : maVarUsesSet)
{ // checking the location of the var instead of the function because for some reason // I'm not getting accurate results from clang right now
StringRef aFileName = getFilename(varLoc); // TODO these files are doing some weird stuff I don't know how to ignore yet if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/vcl/source/filter/")) { returntrue;
} if (loplugin::isSamePathname(aFileName, SRCDIR "/sw/source/core/layout/frmtool.cxx")) { returntrue;
}
if (maVarNewSet.find(varLoc) == maVarNewSet.end()) continue; if (maVarIgnoreSet.find(varLoc) != maVarIgnoreSet.end()) continue;
report(DiagnosticsEngine::Warning, "calling new and delete on a local var, rather use std::unique_ptr",
varLoc)
<< maVarDeclSourceRangeMap[varLoc];
report(DiagnosticsEngine::Note, "delete called here",
maVarDeleteSourceRangeMap[varLoc].getBegin())
<< maVarDeleteSourceRangeMap[varLoc];
} returntrue;
}
bool MemoryVar::VisitCXXDeleteExpr(const CXXDeleteExpr *deleteExpr)
{ if (!mbChecking) returntrue; if (ignoreLocation(deleteExpr)) { returntrue;
} const Expr* argumentExpr = deleteExpr->getArgument(); if (isa<CastExpr>(argumentExpr)) {
argumentExpr = dyn_cast<CastExpr>(argumentExpr)->getSubExpr();
} const DeclRefExpr* declRefExpr = dyn_cast<DeclRefExpr>(argumentExpr); if (!declRefExpr) returntrue; const Decl* decl = declRefExpr->getDecl(); if (!isa<VarDecl>(decl) || isa<ParmVarDecl>(decl)) { returntrue;
} const VarDecl * varDecl = dyn_cast<VarDecl>(decl)->getCanonicalDecl(); if (varDecl->hasGlobalStorage()) { returntrue;
}
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.