[PATCH] D73413: [clang-tidy] Add check to detect external definitions with no header declaration

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 27 15:32:38 PST 2020


njames93 updated this revision to Diff 308121.
njames93 added a comment.

I thought I'd bring this back up.

- Rebased and tweaked to use a few new library features in clang-tidy since when this was first proposed.
- It definitely has value but still maybe got a little bit before its ready to land.
- Right now it will flag template definitions in source files, Is this good or bad behaviour?
- It won't flag instantiations or explicit specializations, though there should be some better tests for that.
- An option has been added to specify ImplementationFileExtensions. The check will only run if the main file matches those extensions. This is useful for editor workflows(like clangd) which run clang-tidy over a header file.

Running it under my local clangd instance has already found quite a few true positives as I go, (Probably should push a patch to fix those.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73413/new/

https://reviews.llvm.org/D73413

Files:
  clang-tools-extra/clang-tidy/misc/CMakeLists.txt
  clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
  clang-tools-extra/clang-tidy/misc/MissingHeaderFileDeclarationCheck.cpp
  clang-tools-extra/clang-tidy/misc/MissingHeaderFileDeclarationCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/misc-missing-header-file-declaration.rst
  clang-tools-extra/test/clang-tidy/checkers/Inputs/misc-missing-header-file-declaration/misc-missing-header-file-declaration.h
  clang-tools-extra/test/clang-tidy/checkers/Inputs/misc-missing-header-file-declaration/wrong_header.h
  clang-tools-extra/test/clang-tidy/checkers/misc-missing-header-file-declaration-any-header.cpp
  clang-tools-extra/test/clang-tidy/checkers/misc-missing-header-file-declaration.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73413.308121.patch
Type: text/x-patch
Size: 21084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201127/289c7e0d/attachment-0001.bin>


More information about the cfe-commits mailing list