compilerplugins/clang/blockblock.cxx | 2 +- compilerplugins/clang/checkunusedparams.cxx | 8 ++++---- compilerplugins/clang/constantparam.cxx | 2 +- compilerplugins/clang/convertlong.cxx | 6 +++--- compilerplugins/clang/includeform.cxx | 6 +++--- compilerplugins/clang/memoryvar.cxx | 4 ++-- compilerplugins/clang/pluginhandler.cxx | 8 ++++---- compilerplugins/clang/staticmethods.cxx | 8 ++++---- compilerplugins/clang/unnecessaryoverride.cxx | 2 +- compilerplugins/clang/useuniqueptr.cxx | 24 ++++++++++++------------ compilerplugins/clang/vclwidgets.cxx | 8 ++++---- 11 files changed, 39 insertions(+), 39 deletions(-)
New commits: commit 449d416335802b23cf0f8f4725042f92138019cd Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Mar 26 13:37:06 2018 +0200 Let prefix arguments to hasPathnamePrefix end in slash ...for better precision Change-Id: I5f273b7c66ba931647805c415622b5ac767ff987 diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx index 461eb52a2e97..cb5a380bac73 100644 --- a/compilerplugins/clang/constantparam.cxx +++ b/compilerplugins/clang/constantparam.cxx @@ -121,7 +121,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde return; SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( functionDecl->getLocation() ); StringRef filename = compiler.getSourceManager().getFilename(expansionLoc); - if (!loplugin::hasPathnamePrefix(filename, SRCDIR)) + if (!loplugin::hasPathnamePrefix(filename, SRCDIR "/")) return; filename = filename.substr(strlen(SRCDIR)+1); diff --git a/compilerplugins/clang/includeform.cxx b/compilerplugins/clang/includeform.cxx index 284b7dadccff..c26a2aea76d6 100644 --- a/compilerplugins/clang/includeform.cxx +++ b/compilerplugins/clang/includeform.cxx @@ -47,10 +47,10 @@ private: bool shouldUseAngles; if (uno) { shouldUseAngles - = (!(loplugin::hasPathnamePrefix(SearchPath, SRCDIR) - || loplugin::hasPathnamePrefix(SearchPath, BUILDDIR)) + = (!(loplugin::hasPathnamePrefix(SearchPath, SRCDIR "/") + || loplugin::hasPathnamePrefix(SearchPath, BUILDDIR "/")) || loplugin::hasPathnamePrefix( - SearchPath, WORKDIR "/UnpackedTarball")); + SearchPath, WORKDIR "/UnpackedTarball/")); } else { auto dir1 = std::string(SearchPath); loplugin::normalizeDotDotInFilePath(dir1); diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx index 168cc8bf175f..17cb2701acd0 100644 --- a/compilerplugins/clang/memoryvar.cxx +++ b/compilerplugins/clang/memoryvar.cxx @@ -80,7 +80,7 @@ bool MemoryVar::TraverseFunctionDecl(FunctionDecl * decl) // 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")) { + if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/vcl/source/filter/")) { return true; } if (loplugin::isSamePathname(aFileName, SRCDIR "/sw/source/core/layout/frmtool.cxx")) { diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 3f169972f6a2..b1e789a4a8c5 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -207,7 +207,7 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) // generated into the start of hash.cxx, #if'ed for __GNUC__, but // for clang-cl it is an issue) return true; - if( hasPathnamePrefix(bufferName, WORKDIR) ) + if( hasPathnamePrefix(bufferName, WORKDIR "/") ) { // workdir/CustomTarget/vcl/unx/kde4/tst_exclude_socket_notifiers.moc // includes @@ -219,11 +219,11 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) } std::string s(bufferName); normalizeDotDotInFilePath(s); - if (hasPathnamePrefix(s, WORKDIR)) + if (hasPathnamePrefix(s, WORKDIR "/")) return true; } - if( hasPathnamePrefix(bufferName, BUILDDIR) - || hasPathnamePrefix(bufferName, SRCDIR) ) + if( hasPathnamePrefix(bufferName, BUILDDIR "/") + || hasPathnamePrefix(bufferName, SRCDIR "/") ) return false; // ok return true; } diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx index f4e1f068ec0e..50d432081f00 100644 --- a/compilerplugins/clang/staticmethods.cxx +++ b/compilerplugins/clang/staticmethods.cxx @@ -117,17 +117,17 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) return true; } // the unotools and svl config code stuff is doing weird stuff with a reference-counted statically allocated pImpl class - if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/unotools")) { + if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/unotools/")) { return true; } - if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/svl")) { + if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/svl/")) { return true; } - if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/framework") || loplugin::hasPathnamePrefix(aFilename, SRCDIR "/framework")) { + if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/framework/") || loplugin::hasPathnamePrefix(aFilename, SRCDIR "/framework/")) { return true; } // there is some odd stuff happening here I don't fully understand, leave it for now - if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/canvas") || loplugin::hasPathnamePrefix(aFilename, SRCDIR "/canvas")) { + if (loplugin::hasPathnamePrefix(aFilename, SRCDIR "/include/canvas/") || loplugin::hasPathnamePrefix(aFilename, SRCDIR "/canvas/")) { return true; } // classes that have static data and some kind of weird reference-counting trick in its constructor diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx index c5e483816383..338598985289 100644 --- a/compilerplugins/clang/unnecessaryoverride.cxx +++ b/compilerplugins/clang/unnecessaryoverride.cxx @@ -84,7 +84,7 @@ public: return; if (loplugin::isSamePathname(fn, SRCDIR "/svx/source/dialog/rubydialog.cxx")) return; - if (loplugin::hasPathnamePrefix(fn, SRCDIR "/canvas")) + if (loplugin::hasPathnamePrefix(fn, SRCDIR "/canvas/")) return; if (loplugin::isSamePathname(fn, SRCDIR "/sc/source/ui/view/spelldialog.cxx")) return; diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index d8a4be063cb2..3b3e9ff49e81 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -167,7 +167,7 @@ void UseUniquePtr::CheckDeleteExpr(const CXXDestructorDecl* destructorDecl, cons return; // to ignore things like the CPPUNIT macros StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocStart())); - if (loplugin::hasPathnamePrefix(aFileName, WORKDIR)) + if (loplugin::hasPathnamePrefix(aFileName, WORKDIR "/")) return; // passes and stores pointers to member fields if (loplugin::isSamePathname(aFileName, SRCDIR "/sot/source/sdstor/stgdir.hxx")) commit cbd1f3695f319c8aa4005d19e40a07c6b4dd116e Author: Stephan Bergmann <sberg...@redhat.com> Date: Mon Mar 26 13:26:46 2018 +0200 Use isSamePathname instead of hasPathnamePrefix, where appropriate Change-Id: I75f32fc66877c0fb1e71be3b5e8b6d6c1b9c4d36 diff --git a/compilerplugins/clang/blockblock.cxx b/compilerplugins/clang/blockblock.cxx index 910a3abf3750..065e4572e0e1 100644 --- a/compilerplugins/clang/blockblock.cxx +++ b/compilerplugins/clang/blockblock.cxx @@ -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()); diff --git a/compilerplugins/clang/checkunusedparams.cxx b/compilerplugins/clang/checkunusedparams.cxx index 8dbea6bd72a2..31dae1c66e61 100644 --- a/compilerplugins/clang/checkunusedparams.cxx +++ b/compilerplugins/clang/checkunusedparams.cxx @@ -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; diff --git a/compilerplugins/clang/convertlong.cxx b/compilerplugins/clang/convertlong.cxx index 4d713aeecf2b..b706d7dffaa4 100644 --- a/compilerplugins/clang/convertlong.cxx +++ b/compilerplugins/clang/convertlong.cxx @@ -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; diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx index a381563d6509..168cc8bf175f 100644 --- a/compilerplugins/clang/memoryvar.cxx +++ b/compilerplugins/clang/memoryvar.cxx @@ -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; } diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index dfa0917735f0..d8a4be063cb2 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -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( diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx index c2cfeaa08095..af2b1bf46cdd 100644 --- a/compilerplugins/clang/vclwidgets.cxx +++ b/compilerplugins/clang/vclwidgets.cxx @@ -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, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits