Kaydet (Commit) 6028b64e authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:passstuffbyref even more return improvements

Change-Id: I2a752025cd429e4d271626402dce5d8a8b0c76d2
Reviewed-on: https://gerrit.libreoffice.org/47021Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 92bab0f1
......@@ -1175,7 +1175,7 @@ namespace basegfx
return mpPolygon->count();
}
B2DPoint B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
B2DPoint const & B2DPolygon::getB2DPoint(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)");
......@@ -1399,12 +1399,12 @@ namespace basegfx
}
}
B2DPolygon B2DPolygon::getDefaultAdaptiveSubdivision() const
B2DPolygon const & B2DPolygon::getDefaultAdaptiveSubdivision() const
{
return mpPolygon->getDefaultAdaptiveSubdivision(*this);
}
B2DRange B2DPolygon::getB2DRange() const
B2DRange const & B2DPolygon::getB2DRange() const
{
return mpPolygon->getB2DRange(*this);
}
......
......@@ -230,7 +230,7 @@ namespace basegfx
return mpPolyPolygon->count();
}
B2DPolygon B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
B2DPolygon const & B2DPolyPolygon::getB2DPolygon(sal_uInt32 nIndex) const
{
OSL_ENSURE(nIndex < mpPolyPolygon->count(), "B2DPolyPolygon access outside range (!)");
......
......@@ -482,7 +482,7 @@ namespace utils
mpImpl->xorPolyPolygon(rPolyPoly);
}
B2DPolyPolygon B2DClipState::getClipPoly() const
B2DPolyPolygon const & B2DClipState::getClipPoly() const
{
return mpImpl->getClipPoly();
}
......
......@@ -229,6 +229,10 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
return;
}
// not sure if it's possible to modify these
if (isa<CXXConversionDecl>(functionDecl))
return;
// ignore stuff that forms part of the stable URE interface
if (isInUnoIncludeFile(functionDecl)) {
return;
......@@ -267,6 +271,9 @@ void PassStuffByRef::checkReturnValue(const FunctionDecl * functionDecl, const C
if (startswith(type.getAsString(), "struct o3tl::strong_int")) {
return;
}
//functionDecl->dump();
mbInsideFunctionDecl = true;
mbFoundReturnValueDisqualifier = false;
TraverseStmt(functionDecl->getBody());
......@@ -395,7 +402,9 @@ bool PassStuffByRef::isReturnExprDisqualified(const Expr* expr)
FunctionDecl const * calleeFunctionDecl = callExpr->getDirectCallee();
if (!calleeFunctionDecl)
return true;
return !loplugin::TypeCheck(calleeFunctionDecl->getReturnType()).LvalueReference();
auto tc = loplugin::TypeCheck(calleeFunctionDecl->getReturnType());
if (!tc.LvalueReference() && !tc.Pointer())
return true;
}
return false;
}
......
......@@ -9,6 +9,7 @@
#include <rtl/ustring.hxx>
#include <sys/time.h>
#include <o3tl/cow_wrapper.hxx>
#include <vector>
struct S1 {
......@@ -21,6 +22,7 @@ struct S2 {
OUString mv3[2];
S1 child;
static OUString gs1;
o3tl::cow_wrapper<S1> mxCow;
// make sure we ignore cases where the passed in parameter is std::move'd