summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-18 12:28:31 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-18 18:19:09 +0200
commit4dbe4a9313d9844c10f71b29a77218d31bc6f3b3 (patch)
treecaf0ca4ceb3cbbb2aaf1255cebbcb8b38d6d45c5 /compilerplugins
parent9e1aee666fa48b768c829bbc707f47a98250df1e (diff)
loplugin:passstuffbyref
Change-Id: I4f01eb3842ef198f02af274f54afb2760c820a4b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120655 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/passstuffbyref.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx
index cff1e781455c..d6ab91fc82a1 100644
--- a/compilerplugins/clang/passstuffbyref.cxx
+++ b/compilerplugins/clang/passstuffbyref.cxx
@@ -286,8 +286,17 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
return;
}
+ auto tc = loplugin::TypeCheck(functionDecl->getReturnType());
+ // these functions are passed by function-pointer
+ if (functionDecl->getIdentifier() && functionDecl->getName() == "GetRanges"
+ && tc.Struct("WhichRangesContainer").GlobalNamespace())
+ return;
+ // extremely simple class, might as well pass by value
+ if (tc.Class("Color")) {
+ return;
+ }
// extremely simple class, might as well pass by value
- if (loplugin::TypeCheck(functionDecl->getReturnType()).Class("Color")) {
+ if (tc.Struct("TranslateId")) {
return;
}