[PATCH] D125769: [clang-tidy] Introduce the WarnIntoHeaders option to modernize-deprecated-headers

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 06:01:56 PDT 2022


steakhal created this revision.
steakhal added reviewers: aaron.ballman, whisperity, LegalizeAdulthood, alexfh.
Herald added subscribers: carlosgalvezp, martong, rnkovacs, xazax.hun.
Herald added a project: All.
steakhal requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125769

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125769.430015.patch
Type: text/x-patch
Size: 7455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220517/2a7c2f61/attachment.bin>


More information about the cfe-commits mailing list