[clang-tools-extra] [clang-tidy] Add bugprone-move-shared-pointer-contents check. (PR #67467)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 08:48:24 PST 2024


pizzud wrote:

Yep. I've been slammed at work with other stuff and also ran into a knotty
problem I haven't managed to find a solution for: when
shared_ptr::operator* and/or get() are defined in a parent of shared_ptr,
the returned class from the matchers is the parent, not the class in the
config. This was revealed when I switched to the other check's testdata
implementation, and it's a really good thing it was because MSVC and either
libc++ or libstdc++ (I forget which) implement shared_ptr this way. I've
been meaning to ask the internal clang-tidy experts if they have any ideas,
but haven't managed to free up enough time. =/ Accessing the class with the
method definition is easy, but we have a subclass and the available methods
in CXXRecordDecl only let you go up the inheritance tree, not down. I was
hoping to get back to this later this week.

On Wed, Mar 6, 2024 at 8:42 AM Piotr Zegar ***@***.***> wrote:

> @pizzud <https://github.com/pizzud> Do you plan to finish this check,
> just asking as idea behind it is really good.
>
>> Reply to this email directly, view it on GitHub
> <https://github.com/llvm/llvm-project/pull/67467#issuecomment-1981309710>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/A5LI24JQ3UELX3YBUN57JGLYW5BQZAVCNFSM6AAAAAA5IDKJ7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBRGMYDSNZRGA>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>


https://github.com/llvm/llvm-project/pull/67467


More information about the cfe-commits mailing list