From 0c17712465b07e8a7ebe078b00123965b112f0ac Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 23 May 2022 10:03:30 +0200 Subject: [PATCH] clang-tidy modernize-pass-by-value in jvmaccess Change-Id: I9a2ef4370136b0f26ae3590f358025e7d89f30d2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134757 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/jvmaccess/unovirtualmachine.hxx | 3 +-- include/jvmaccess/virtualmachine.hxx | 2 +- jvmaccess/source/unovirtualmachine.cxx | 5 +++-- jvmaccess/source/virtualmachine.cxx | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/jvmaccess/unovirtualmachine.hxx b/include/jvmaccess/unovirtualmachine.hxx index f3e34e641d6b..1b424dba9c6a 100644 --- a/include/jvmaccess/unovirtualmachine.hxx +++ b/include/jvmaccess/unovirtualmachine.hxx @@ -64,8 +64,7 @@ public: @exception CreationException Thrown in case creation fails (due to a JNI problem). */ - UnoVirtualMachine(rtl::Reference const& virtualMachine, - void* classLoader); + UnoVirtualMachine(rtl::Reference virtualMachine, void* classLoader); /** Get the Java virtual machine wrapper. diff --git a/include/jvmaccess/virtualmachine.hxx b/include/jvmaccess/virtualmachine.hxx index b4edf4de98d9..e1286e70017f 100644 --- a/include/jvmaccess/virtualmachine.hxx +++ b/include/jvmaccess/virtualmachine.hxx @@ -73,7 +73,7 @@ public: @exception CreationException Thrown in case attaching fails (due to a JNI problem). */ - explicit AttachGuard(rtl::Reference const& rMachine); + explicit AttachGuard(rtl::Reference xMachine); /** Detach the current thread from the virtual machine again. */ diff --git a/jvmaccess/source/unovirtualmachine.cxx b/jvmaccess/source/unovirtualmachine.cxx index 5387497326d4..08bfbcdcfe5e 100644 --- a/jvmaccess/source/unovirtualmachine.cxx +++ b/jvmaccess/source/unovirtualmachine.cxx @@ -23,6 +23,7 @@ #include #include +#include #include @@ -40,9 +41,9 @@ UnoVirtualMachine::CreationException::operator =(CreationException const &) { } UnoVirtualMachine::UnoVirtualMachine( - rtl::Reference< jvmaccess::VirtualMachine > const & virtualMachine, + rtl::Reference< jvmaccess::VirtualMachine > virtualMachine, void * classLoader): - m_virtualMachine(virtualMachine), + m_virtualMachine(std::move(virtualMachine)), m_classLoader(nullptr) { try { diff --git a/jvmaccess/source/virtualmachine.cxx b/jvmaccess/source/virtualmachine.cxx index c37d555f23ca..eb4b8069cad7 100644 --- a/jvmaccess/source/virtualmachine.cxx +++ b/jvmaccess/source/virtualmachine.cxx @@ -23,6 +23,7 @@ #include #include +#include using jvmaccess::VirtualMachine; @@ -41,8 +42,8 @@ VirtualMachine::AttachGuard::CreationException::operator =( } VirtualMachine::AttachGuard::AttachGuard( - rtl::Reference< VirtualMachine > const & rMachine): - m_xMachine(rMachine) + rtl::Reference< VirtualMachine > xMachine): + m_xMachine(std::move(xMachine)) { assert(m_xMachine.is()); m_pEnvironment = m_xMachine->attachThread(&m_bDetach);