[all-commits] [llvm/llvm-project] 060646: [clang-tidy] Introduce the WarnIntoHeaders option ...

Balazs Benics via All-commits all-commits at lists.llvm.org
Fri May 20 12:44:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0606467ea122da5cb23a588e1222a4140445734a
      https://github.com/llvm/llvm-project/commit/0606467ea122da5cb23a588e1222a4140445734a
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2022-05-20 (Fri, 20 May 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
    M clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/modernize-deprecated-headers.rst
    M clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp

  Log Message:
  -----------
  [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

Unfortunately, we must restrict the checker to warn for deprecated headers
only if the header is included directly from a c++ source file.

For header files, we cannot know if the project has a C source file
that also directly/indirectly includes the offending header file
otherwise. Thus, it's better to be on the safe side and suppress those
reports.

One can opt-in the old behavior, emitting diagnostics into header files,
if one explicitly sets the WarnIntoHeaders=true, in which case nothing
will be changed.

Reviewed By: LegalizeAdulthood

Differential Revision: https://reviews.llvm.org/D125769


  Commit: 6fa82e344c291cf0e1134b357b1f09fd2dcd3f4f
      https://github.com/llvm/llvm-project/commit/6fa82e344c291cf0e1134b357b1f09fd2dcd3f4f
  Author: Balazs Benics <balazs.benics at sigmatechnology.se>
  Date:   2022-05-20 (Fri, 20 May 2022)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/DeprecatedHeadersCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize-deprecated-headers-extern-c.cpp

  Log Message:
  -----------
  [clang-tidy] modernize-deprecated-headers should ignore system headers

The end-user has no way of 'fixing' bugs in the system library anyway.
Let's suppress these as well.

Reviewed By: LegalizeAdulthood

Differential Revision: https://reviews.llvm.org/D125770


Compare: https://github.com/llvm/llvm-project/compare/20ec4161d7c9...6fa82e344c29


More information about the All-commits mailing list