summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/passstuffbyref.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-03-23 20:14:15 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-03-27 09:43:58 +0000
commitd615af618cc6a7152c76a49b3cd09db38eaa9e07 (patch)
treebc0d69070444dc687708de9a4a146c5c2d3b6852 /compilerplugins/clang/passstuffbyref.cxx
parent6f968f00b1534406a2943be374fab924c3396482 (diff)
create SfxInterfaceId o3tl::strong_int
Change-Id: Ie52f63382a9fb36f9a472801be012b140bfb51f6 Reviewed-on: https://gerrit.libreoffice.org/35722 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/passstuffbyref.cxx')
-rw-r--r--compilerplugins/clang/passstuffbyref.cxx11
1 files changed, 9 insertions, 2 deletions
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<OverrideAttr>())) {
@@ -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())