[all-commits] [llvm/llvm-project] 75f76d: [clang-tidy] Add bugprone-smartptr-reset-ambiguous...

Baranov Victor via All-commits all-commits at lists.llvm.org
Mon Mar 10 23:22:38 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75f76d482cc24162d5e3fdae0f0acd4c8f9cec6b
      https://github.com/llvm/llvm-project/commit/75f76d482cc24162d5e3fdae0f0acd4c8f9cec6b
  Author: Baranov Victor <bar.victor.2002 at gmail.com>
  Date:   2025-03-11 (Tue, 11 Mar 2025)

  Changed paths:
    A clang-tools-extra/clang-tidy/readability/AmbiguousSmartptrResetCallCheck.cpp
    A clang-tools-extra/clang-tidy/readability/AmbiguousSmartptrResetCallCheck.h
    M clang-tools-extra/clang-tidy/readability/CMakeLists.txt
    M clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/docs/clang-tidy/checks/readability/ambiguous-smartptr-reset-call.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/ambiguous-smartptr-reset-call-custom-pointers.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability/ambiguous-smartptr-reset-call.cpp

  Log Message:
  -----------
  [clang-tidy] Add bugprone-smartptr-reset-ambiguous-call check (#121291)

Add new clang-tidy check that finds potentially erroneous calls to
``reset()`` method on smart pointers when
the pointee type also has a ``reset()`` method.

It's easy to make typo and delete object because the difference between
``.`` and ``->`` is really small.

Sometimes IDE's autocomplete will change ``->`` to ``.`` automatically.
For example, developer wrote ``ptr->res`` but after pressing _Tab_ it
became ``ptr.reset()``.

Fixes #120908



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list