PiotrZSL wrote:
Personally I think that check for move out of std::unique_ptr, and check for
overall heavy moves could be implemented as an separate one, not related to
unique_ptr. Easiest way to detect heavy moves is to check size of object, and
above some threshold mark them as heavy. But
pizzud wrote:
After looking at the various comments (thanks all!) it feels like the consensus
was:
- don't suggest fixes (done)
- move shared_ptr out to its own check (done in #67467 )
- be more precise in both language and implementation
Is there a reasonable way to detect expensive moves?
https://github.com/pizzud resolved
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/pizzud resolved
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/pizzud resolved
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/pizzud updated
https://github.com/llvm/llvm-project/pull/66139
>From b699129b21c95571410a809d16fdf8cfcf1526c5 Mon Sep 17 00:00:00 2001
From: David Pizzuto
Date: Tue, 12 Sep 2023 13:24:48 -0700
Subject: [PATCH 1/2] [clang-tidy] Add performance-move-smart-pointer-contents
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
pizzud wrote:
Done.
https://github.com/pizzud resolved
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/pizzud updated
https://github.com/llvm/llvm-project/pull/66139
>From b699129b21c95571410a809d16fdf8cfcf1526c5 Mon Sep 17 00:00:00 2001
From: David Pizzuto
Date: Tue, 12 Sep 2023 13:24:48 -0700
Subject: [PATCH 1/3] [clang-tidy] Add performance-move-smart-pointer-contents
pizzud wrote:
Extracted the shared_ptr parts to
https://github.com/llvm/llvm-project/pull/67467. I'll continue the unique_ptr
portion here and respond to those comments later today.
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
EugeneZelenko wrote:
Please
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
+`std::unique_ptr`, it's possible to move the
@@ -0,0 +1,95 @@
+//===--- MoveSmartPointerContentsCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier:
@@ -0,0 +1,95 @@
+//===--- MoveSmartPointerContentsCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier:
@@ -0,0 +1,95 @@
+//===--- MoveSmartPointerContentsCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier:
https://github.com/martinboehme edited
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
martinboehme wrote:
> This check has issue in my opinion, the semantic of `std::move(*p)` is not
> same as `*std::move(p)`
Agree that the suggested fix may not always be correct.
I would suggest simply not emitting a suggested fix (i.e. only emitting a
warning).
martinboehme wrote:
> > I don't see problem described by this check as an performance issue. For
> > example:
> > ```
> > std::unique_ptr> ptr;
> > std::vector local = std::move(*ptr);
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > No
https://github.com/HerrCai0907 edited
https://github.com/llvm/llvm-project/pull/66139
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/HerrCai0907 requested changes to this pull request.
This check has some issue in my opinion, the semantic of `std::move(*p)` are
not same as `*std::move(p)`
```c++
#include
#include
#include
using std::unique_ptr;
void f1() {
unique_ptr p{new std::string("demo")};
@@ -0,0 +1,23 @@
+.. title:: clang-tidy - performance-move-smart-pointer-contents
+
+performance-move-smart-pointer-contents
+===
+
+Given a smart pointer containing a movable type, such as a
+`std::unique_ptr`, it's possible to move the
pizzud wrote:
> I don't see problem described by this check as an performance issue. For
> example:
>
> ```
> std::unique_ptr> ptr;
> std::vector local = std::move(*ptr);
> ```
>
> No performance issue here, simply value may need to be moved, do not expect
> that someone have to always keep
https://github.com/pizzud updated
https://github.com/llvm/llvm-project/pull/66139:
>From b699129b21c95571410a809d16fdf8cfcf1526c5 Mon Sep 17 00:00:00 2001
From: David Pizzuto
Date: Tue, 12 Sep 2023 13:24:48 -0700
Subject: [PATCH 1/3] [clang-tidy] Add performance-move-smart-pointer-contents
@@ -0,0 +1,80 @@
+//===--- MoveSmartPointerContentsCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier:
@@ -0,0 +1,80 @@
+//===--- MoveSmartPointerContentsCheck.cpp - clang-tidy
---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier:
https://github.com/pizzud updated
https://github.com/llvm/llvm-project/pull/66139:
>From b699129b21c95571410a809d16fdf8cfcf1526c5 Mon Sep 17 00:00:00 2001
From: David Pizzuto
Date: Tue, 12 Sep 2023 13:24:48 -0700
Subject: [PATCH 1/2] [clang-tidy] Add performance-move-smart-pointer-contents
26 matches
Mail list logo