[mlir] [lldb] [clang-tools-extra] [llvm] [flang] [libcxx] [openmp] [libc] [compiler-rt] [clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-12-06 Thread Piotr Zegar via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via cfe-commits
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?

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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 pizzud wrote: Done.

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-26 Thread via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-14 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-14 Thread via 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 +`std::unique_ptr`, it's possible to move the

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via cfe-commits
@@ -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:

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via cfe-commits
@@ -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:

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via cfe-commits
@@ -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:

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via 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).

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-13 Thread via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread Congcong Cai via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread Congcong Cai via 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")};

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread Congcong Cai via 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 +`std::unique_ptr`, it's possible to move the

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread via cfe-commits
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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread via 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

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread via cfe-commits
@@ -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:

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread via cfe-commits
@@ -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:

[clang] [clang-tidy] Add performance-move-smart-pointer-contents check. (PR #66139)

2023-09-12 Thread via 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