[all-commits] [llvm/llvm-project] 952d34: [clang-tidy] introduce a unused local non trival v...

Tyler Rockwood via All-commits all-commits at lists.llvm.org
Mon Dec 25 03:20:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 952d344f3e25a352bc5f2f1f5f611e96bd7acb91
      https://github.com/llvm/llvm-project/commit/952d344f3e25a352bc5f2f1f5f611e96bd7acb91
  Author: Tyler Rockwood <rockwotj at gmail.com>
  Date:   2023-12-25 (Mon, 25 Dec 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
    M clang-tools-extra/clang-tidy/bugprone/CMakeLists.txt
    A clang-tools-extra/clang-tidy/bugprone/UnusedLocalNonTrivialVariableCheck.cpp
    A clang-tools-extra/clang-tidy/bugprone/UnusedLocalNonTrivialVariableCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/docs/clang-tidy/checks/bugprone/unused-local-non-trivial-variable.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/test/clang-tidy/checkers/bugprone/unused-local-non-trivial-variable.cpp

  Log Message:
  -----------
  [clang-tidy] introduce a unused local non trival variable check (#76101)

Introduce a new (off by default) clang tidy check to ensure that
variables of a specific type are always used even if -Wunused-variables
wouldn't generate a warning.

This check has already caught a couple of different bugs on the codebase
I work on, where not handling a future means that lifetimes may not be
kept alive properly as an async chunk of code may run after a class has
been destroyed, etc.

I would like to upstream it because I believe there could be other
applications of this check that would be useful in different contexts.

---------

Signed-off-by: Tyler Rockwood <rockwood at redpanda.com>




More information about the All-commits mailing list