compilerplugins/clang/toolslong.cxx | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
New commits: commit e0abb6aa78a763d591834fdc7306fcabe6710121 Author: Stephan Bergmann <[email protected]> AuthorDate: Fri Nov 27 13:50:25 2020 +0100 Commit: Stephan Bergmann <[email protected]> CommitDate: Sun Nov 29 17:44:45 2020 +0100 loplugin:toolslong: Don't warn about virtual functions at all Now that all the relevant changes in old code should already have been done anyway, excluding virtual functions nicely avoids clang-cl warnings about the use of long and unsigned long in Windows-only StreamInterface (shell/inc/types.hxx). It is implemented by BufferStream and FileStream (both shell/inc/stream_helper.hxx), of which BufferStream internally uses [U]LARGE_INTEGER-based IStream and FileStream internally uses long (fseek, ftell) resp. size_t (fread) based FILE, so basing the common interface on [unsigned] long doesn't look like too unreasonable a choice. Change-Id: I563d59a8ca8a0ee37f46e2676ae8d00f6ea24597 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106768 Reviewed-by: Noel Grandin <[email protected]> Reviewed-by: Stephan Bergmann <[email protected]> Tested-by: Jenkins diff --git a/compilerplugins/clang/toolslong.cxx b/compilerplugins/clang/toolslong.cxx index 5a3932e90dbd..fd3f2e2bd932 100644 --- a/compilerplugins/clang/toolslong.cxx +++ b/compilerplugins/clang/toolslong.cxx @@ -479,13 +479,18 @@ bool ToolsLong::VisitParmVarDecl(ParmVarDecl const* decl) auto canonicalF = f->getCanonicalDecl(); if (canonicalF->isDeletedAsWritten() && isa<CXXConversionDecl>(canonicalF)) return true; + if (auto const d = dyn_cast<CXXMethodDecl>(canonicalF)) + { + if (d->isVirtual()) + { + return true; + } + } // Only rewrite declarations in include files if a definition is // also seen, to avoid compilation of a definition (in a main file // only processed later) to fail with a "mismatch" error before the - // rewriter had a chance to act upon the definition (but use the - // heuristic of assuming pure virtual functions do not have - // definitions): - bool ok = canonicalF->isDefined() || canonicalF->isPure() + // rewriter had a chance to act upon the definition: + bool ok = canonicalF->isDefined() || compiler.getSourceManager().isInMainFile( compiler.getSourceManager().getSpellingLoc(f->getNameInfo().getLoc())); if (!ok) @@ -544,7 +549,14 @@ bool ToolsLong::VisitFunctionDecl(FunctionDecl const* decl) return true; if (decl->isDeletedAsWritten() && isa<CXXConversionDecl>(decl)) return true; - if (decl->isPure() || decl->isDefined() + if (auto const d = dyn_cast<CXXMethodDecl>(decl)) + { + if (d->isVirtual()) + { + return true; + } + } + if (decl->isDefined() || compiler.getSourceManager().isInMainFile( compiler.getSourceManager().getSpellingLoc(decl->getNameInfo().getLoc()))) { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
