[PATCH] D111909: [clang-tidy] DefinitionsInHeadersCheck: Added option for checking C Code
Whisperity via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 18 03:11:03 PDT 2021
whisperity added a comment.
It would be interesting to add a test for this. I've recently came across the fact that Clang doesn't support //common linkage// definitions, namely that in **C** (but not in C++), if you do the following:
int I;
void f1(void) {}
int I;
void f2(void) {}
and compile these two source files and link them together, the two `I`s will refer in the resulting binary to the same symbol. (You must not put an initialiser here!) Will `int I;` being in a header, with no initialiser, be caught?
================
Comment at: clang-tools-extra/clang-tidy/misc/DefinitionsInHeadersCheck.h:26
+/// - `CheckCCode`: Adds C99 to the minimum Language Requirements for this
+/// Checker. Disabled by default because this Checker wasn't build for C.
/// - `HeaderFileExtensions`: a semicolon-separated list of filename
----------------
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/misc-definitions-in-headers.rst:109
+ When `true` C99 is added to the minimum language requirements for this
+ Cecker. Default is `false` because this Checker was not build for C.
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111909/new/
https://reviews.llvm.org/D111909
More information about the cfe-commits
mailing list