From d615af618cc6a7152c76a49b3cd09db38eaa9e07 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 23 Mar 2017 20:14:15 +0200 Subject: create SfxInterfaceId o3tl::strong_int Change-Id: Ie52f63382a9fb36f9a472801be012b140bfb51f6 Reviewed-on: https://gerrit.libreoffice.org/35722 Tested-by: Jenkins Reviewed-by: Noel Grandin --- compilerplugins/clang/passstuffbyref.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx index 8b60b5c353e7..12c13d1b6c89 100644 --- a/compilerplugins/clang/passstuffbyref.cxx +++ b/compilerplugins/clang/passstuffbyref.cxx @@ -252,6 +252,10 @@ void PassStuffByRef::checkParams(const FunctionDecl * functionDecl) { } } +static bool startswith(const std::string& rStr, const char* pSubStr) { + return rStr.compare(0, strlen(pSubStr), pSubStr) == 0; +} + void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const CXXMethodDecl * methodDecl) { if (methodDecl && (methodDecl->isVirtual() || methodDecl->hasAttr())) { @@ -303,6 +307,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C .GlobalNamespace()) { return; } + if (startswith(type.getAsString(), "struct o3tl::strong_int")) { + return; + } mbInsideFunctionDecl = true; mbFoundDisqualifier = false; TraverseStmt(functionDecl->getBody()); @@ -313,9 +320,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C report( DiagnosticsEngine::Warning, - "rather return %0 from function %1 %2 by const& than by value, to avoid unnecessary copying", + "rather return %0 from function %1 by const& than by value, to avoid unnecessary copying", functionDecl->getSourceRange().getBegin()) - << type.getAsString() << functionDecl->getQualifiedNameAsString() << type->getTypeClassName() << functionDecl->getSourceRange(); + << type.getAsString() << functionDecl->getQualifiedNameAsString() << functionDecl->getSourceRange(); // display the location of the class member declaration so I don't have to search for it by hand if (functionDecl->getSourceRange().getBegin() != functionDecl->getCanonicalDecl()->getSourceRange().getBegin()) -- cgit