compilerplugins/clang/passstuffbyref.cxx | 2 +- compilerplugins/clang/test/passstuffbyref.cxx | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-)
New commits: commit 9d7802e7fc055d5d4d28fcf01461e8a7dbe208a0 Author: Stephan Bergmann <sberg...@redhat.com> Date: Fri Dec 16 15:16:37 2016 +0100 Make move detection in loplugin::passstuffbyref work for parenthesized cases Change-Id: I56754a718af9433c0fa654ccb8eb34da00e75420 diff --git a/compilerplugins/clang/passstuffbyref.cxx b/compilerplugins/clang/passstuffbyref.cxx index fca6b73..8bbea52 100644 --- a/compilerplugins/clang/passstuffbyref.cxx +++ b/compilerplugins/clang/passstuffbyref.cxx @@ -201,7 +201,7 @@ void PassStuffByRef::checkParams(const FunctionDecl * functionDecl) { for (CXXCtorInitializer const * cxxCtorInitializer : cxxConstructorDecl->inits()) { if (cxxCtorInitializer->isMemberInitializer()) { - auto cxxConstructExpr = dyn_cast<CXXConstructExpr>(cxxCtorInitializer->getInit()); + auto cxxConstructExpr = dyn_cast<CXXConstructExpr>(cxxCtorInitializer->getInit()->IgnoreParenImpCasts()); if (cxxConstructExpr && cxxConstructExpr->getNumArgs() == 1) { if (auto callExpr = dyn_cast<CallExpr>(cxxConstructExpr->getArg(0)->IgnoreParenImpCasts())) { diff --git a/compilerplugins/clang/test/passstuffbyref.cxx b/compilerplugins/clang/test/passstuffbyref.cxx index d871c5b..7c31af7 100644 --- a/compilerplugins/clang/test/passstuffbyref.cxx +++ b/compilerplugins/clang/test/passstuffbyref.cxx @@ -10,19 +10,20 @@ #include <rtl/ustring.hxx> struct S { - OUString mv; + OUString mv1; + OUString mv2; // make sure we ignore cases where the passed in parameter is std::move'd - S(OUString v) - : mv(std::move(v)) {} + S(OUString v1, OUString v2) + : mv1(std::move(v1)), mv2((std::move(v2))) {} }; void f() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}} { S* s; - OUString v; - s = new S(v); + OUString v1, v2; + s = new S(v1, v2); } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits