Use isSamePathname instead of hasPathnamePrefix, where appropriate
Change-Id: I75f32fc66877c0fb1e71be3b5e8b6d6c1b9c4d36
This commit is contained in:
parent
add1784e13
commit
cbd1f3695f
@ -30,7 +30,7 @@ public:
|
||||
{
|
||||
StringRef fn( compiler.getSourceManager().getFileEntryForID(
|
||||
compiler.getSourceManager().getMainFileID())->getName() );
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sal/osl/unx/file_misc.cxx"))
|
||||
if (loplugin::isSamePathname(fn, SRCDIR "/sal/osl/unx/file_misc.cxx"))
|
||||
return;
|
||||
|
||||
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
|
||||
|
@ -68,16 +68,16 @@ void CheckUnusedParams::run()
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/xmloff/"))
|
||||
return;
|
||||
// I believe someone is busy working on this chunk of code
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/ui/docshell/dataprovider.cxx"))
|
||||
if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/docshell/dataprovider.cxx"))
|
||||
return;
|
||||
// I think erack is working on stuff here
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/filter/excel/xiformula.cxx"))
|
||||
if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/excel/xiformula.cxx"))
|
||||
return;
|
||||
// lots of callbacks here
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/filter/lotus/op.cxx"))
|
||||
if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/lotus/op.cxx"))
|
||||
return;
|
||||
// template magic
|
||||
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/filter/html/htmlpars.cxx"))
|
||||
if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/filter/html/htmlpars.cxx"))
|
||||
return;
|
||||
|
||||
m_phase = PluginPhase::FindAddressOf;
|
||||
|
@ -75,11 +75,11 @@ bool ConvertLong::VisitVarDecl(VarDecl const* varDecl)
|
||||
if (ignoreLocation(varDecl))
|
||||
return true;
|
||||
StringRef fileName{ compiler.getSourceManager().getFilename(varDecl->getLocation()) };
|
||||
if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/bigint.hxx"))
|
||||
if (loplugin::isSamePathname(fileName, SRCDIR "/include/tools/bigint.hxx"))
|
||||
return true;
|
||||
if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/tools/solar.h"))
|
||||
if (loplugin::isSamePathname(fileName, SRCDIR "/include/tools/solar.h"))
|
||||
return true;
|
||||
if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/include/o3tl/string_view.hxx"))
|
||||
if (loplugin::isSamePathname(fileName, SRCDIR "/include/o3tl/string_view.hxx"))
|
||||
return true;
|
||||
if (!varDecl->hasInit())
|
||||
return true;
|
||||
|
@ -83,7 +83,7 @@ bool MemoryVar::TraverseFunctionDecl(FunctionDecl * decl)
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/vcl/source/filter")) {
|
||||
return true;
|
||||
}
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sw/source/core/layout/frmtool.cxx")) {
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sw/source/core/layout/frmtool.cxx")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -170,22 +170,22 @@ void UseUniquePtr::CheckDeleteExpr(const CXXDestructorDecl* destructorDecl, cons
|
||||
if (loplugin::hasPathnamePrefix(aFileName, WORKDIR))
|
||||
return;
|
||||
// passes and stores pointers to member fields
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sot/source/sdstor/stgdir.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sot/source/sdstor/stgdir.hxx"))
|
||||
return;
|
||||
// something platform-specific
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/hwpfilter/source/htags.h"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/hwpfilter/source/htags.h"))
|
||||
return;
|
||||
// passes pointers to member fields
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sd/inc/sdpptwrp.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sd/inc/sdpptwrp.hxx"))
|
||||
return;
|
||||
// @TODO intrusive linked-lists here, with some trickiness
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sw/source/filter/html/parcss1.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sw/source/filter/html/parcss1.hxx"))
|
||||
return;
|
||||
// @TODO SwDoc has some weird ref-counting going on
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sw/inc/shellio.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sw/inc/shellio.hxx"))
|
||||
return;
|
||||
// @TODO it's sharing pointers with another class
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sc/inc/formulacell.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sc/inc/formulacell.hxx"))
|
||||
return;
|
||||
// some weird stuff going on here around struct Entity
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sax/"))
|
||||
@ -198,23 +198,23 @@ void UseUniquePtr::CheckDeleteExpr(const CXXDestructorDecl* destructorDecl, cons
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/sot/"))
|
||||
return;
|
||||
// the std::vector is being passed to another class
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sfx2/source/explorer/nochaos.cxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/sfx2/source/explorer/nochaos.cxx"))
|
||||
return;
|
||||
// ignore std::map and std::unordered_map, MSVC 2015 has problems with mixing these with std::unique_ptr
|
||||
auto tc = loplugin::TypeCheck(fieldDecl->getType());
|
||||
if (tc.Class("map").StdNamespace() || tc.Class("unordered_map").StdNamespace())
|
||||
return;
|
||||
// there is a loop in ~ImplPrnQueueList deleting stuff on a global data structure
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/vcl/inc/print.h"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/vcl/inc/print.h"))
|
||||
return;
|
||||
// painful linked list
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/basic/source/inc/runtime.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/basic/source/inc/runtime.hxx"))
|
||||
return;
|
||||
// not sure how the node management is working here
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/i18npool/source/localedata/saxparser.cxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/i18npool/source/localedata/saxparser.cxx"))
|
||||
return;
|
||||
// has a pointer that it only sometimes owns
|
||||
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/editeng/source/editeng/impedit.hxx"))
|
||||
if (loplugin::isSamePathname(aFileName, SRCDIR "/editeng/source/editeng/impedit.hxx"))
|
||||
return;
|
||||
|
||||
report(
|
||||
|
@ -240,9 +240,9 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
|
||||
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
|
||||
pCXXDestructorDecl->getLocStart());
|
||||
StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
|
||||
if ( !(loplugin::hasPathnamePrefix(filename, SRCDIR "/vcl/source/window/window.cxx"))
|
||||
&& !(loplugin::hasPathnamePrefix(filename, SRCDIR "/vcl/source/gdi/virdev.cxx"))
|
||||
&& !(loplugin::hasPathnamePrefix(filename, SRCDIR "/vcl/qa/cppunit/lifecycle.cxx")) )
|
||||
if ( !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/window/window.cxx"))
|
||||
&& !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/gdi/virdev.cxx"))
|
||||
&& !(loplugin::isSamePathname(filename, SRCDIR "/vcl/qa/cppunit/lifecycle.cxx")) )
|
||||
{
|
||||
report(
|
||||
DiagnosticsEngine::Warning,
|
||||
@ -670,7 +670,7 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
|
||||
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
|
||||
pCXXDeleteExpr->getLocStart());
|
||||
StringRef filename = compiler.getSourceManager().getFilename(spellingLocation);
|
||||
if ( !(loplugin::hasPathnamePrefix(filename, SRCDIR "/include/vcl/vclreferencebase.hxx")))
|
||||
if ( !(loplugin::isSamePathname(filename, SRCDIR "/include/vcl/vclreferencebase.hxx")))
|
||||
{
|
||||
report(
|
||||
DiagnosticsEngine::Warning,
|
||||
|
Loading…
x
Reference in New Issue
Block a user