summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-08-18 11:35:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-08-18 13:44:43 +0200
commit010e2a574c7fadfb60d6794a1bfb38acc8082e0a (patch)
tree22bed9f29aa3291845be4ae9f8cafd7509496a65 /compilerplugins
parente59db22b3b57c9e1a5678218cb56fb75bcc84c26 (diff)
loplugin:moveit
Change-Id: I34de7408553e4ca702cab9aa611c03dc60b9b6a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138472 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/moveit.cxx23
-rw-r--r--compilerplugins/clang/test/moveit.cxx17
2 files changed, 37 insertions, 3 deletions
diff --git a/compilerplugins/clang/moveit.cxx b/compilerplugins/clang/moveit.cxx
index 116e5ddecbd2..ac1718a35ac7 100644
--- a/compilerplugins/clang/moveit.cxx
+++ b/compilerplugins/clang/moveit.cxx
@@ -42,9 +42,26 @@ public:
{
std::string fn(handler.getMainFileName());
loplugin::normalizeDotDotInFilePath(fn);
- // // false +
- // if (loplugin::hasPathnamePrefix(fn, SRCDIR "/basctl/source/basicide/moduldlg.cxx"))
- // return false;
+ // false +, needs to check if the moved-from var is outside a loop
+ if (loplugin::hasPathnamePrefix(
+ fn, SRCDIR "/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(
+ fn, SRCDIR "/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/drawinglayer/source/tools/emfphelperdata.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/sc/source/core/tool/reftokenhelper.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn,
+ SRCDIR "/svx/source/svdraw/svdotextpathdecomposition.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/source/svdraw/svdcrtv.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/source/table/tablehandles.cxx"))
+ return false;
+ if (loplugin::hasPathnamePrefix(fn, SRCDIR "/svx/source/xoutdev/xpool.cxx"))
+ return false;
return true;
}
diff --git a/compilerplugins/clang/test/moveit.cxx b/compilerplugins/clang/test/moveit.cxx
index dfe64c42777e..9e4fa4f3d814 100644
--- a/compilerplugins/clang/test/moveit.cxx
+++ b/compilerplugins/clang/test/moveit.cxx
@@ -18,6 +18,9 @@ struct Movable
std::shared_ptr<int> x;
void method1();
+
+ Movable();
+ Movable(int);
};
namespace test1a
@@ -85,4 +88,18 @@ struct F
};
}
+// No error expected, because constructing temporary(i.e. rvalue) to pass to param
+namespace test4
+{
+struct F
+{
+ F(Movable);
+ void foo()
+ {
+ F a((Movable(5)));
+ (void)a;
+ }
+};
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */