[cfe-dev] False positives in clang-tidy performance-unnecessary-copy-initialization

Malcolm Parsons via cfe-dev cfe-dev at lists.llvm.org
Thu Nov 17 05:40:56 PST 2016


On 17 November 2016 at 11:00, Stephan Bergmann via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> The
> above is a stripped-down version of a bug introduced in LibreOffice when
> such a clang-tidy recommendation had been taken at face value, see
> <https://cgit.freedesktop.org/libreoffice/core/commit/?id=36a329b6395257d7df2013d23ba4205a5ef72f4d>
> "Fix regression in bubbleSortVersion".

That's a strange way to perform a swap.

There's no warning for this:
rtl::Reference<VendorBase> less = next;
next = cur;
cur = less;

Or it could just use std::swap(cur, next).

I'll let Alex comment on how the check should be fixed.
-- 
Malcolm Parsons



More information about the cfe-dev mailing list