[PATCH] D140290: [clang-tidy] Add misc-static-declaration-in-header check
Carlos Galvez via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 19 03:58:21 PST 2022
carlosgalvezp created this revision.
Herald added a subscriber: xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
carlosgalvezp requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.
Static declarations in header files is considered bad practice,
since header files are meant for sharing code, and static
leads to internal linkage. This can cause code bloat and lead
to subtle issues, for example ODR violations. Essentially, this
is as problematic as having anonymous namespaces in headers,
which we already have checks for.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140290
Files:
clang-tools-extra/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/clang-tidy/misc/StaticDeclarationInHeaderCheck.cpp
clang-tools-extra/clang-tidy/misc/StaticDeclarationInHeaderCheck.h
clang-tools-extra/docs/ReleaseNotes.rst
clang-tools-extra/docs/clang-tidy/checks/list.rst
clang-tools-extra/docs/clang-tidy/checks/misc/static-declaration-in-header.rst
clang-tools-extra/test/clang-tidy/checkers/misc/static-declaration-in-header.hpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140290.483901.patch
Type: text/x-patch
Size: 12656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221219/ff6c5ebf/attachment-0001.bin>
More information about the cfe-commits
mailing list