mirror of
https://github.com/elysium-os/clang-tidy-plugin.git
synced 2026-07-08 19:37:41 +02:00
Custom clang-tidy checks used by Elysium
- C++ 96.6%
- CMake 3.4%
|
|
||
|---|---|---|
| src | ||
| .clang-format | ||
| CMakeLists.txt | ||
| LICENSE | ||
| README.md | ||
Clang Tidy Plugin
This clang tidy plugin are a random assortment of checks for Elysium.
Currently this includes the following checks:
elysium-atomic-onlyCheck that ensures atomics are only used by__atomic_*builtins, whitelisted functions, or whitelisted parameters.elysium-global-prefixCheck that enforces that every global variable definition uses the configured prefix and that only globals may do so.elysium-header-namespaceCheck that enforces globally visible declarations inside headers are prefixed with the header's filename, providing a C-style namespace with configurable casing per symbol kind.
Check options:
elysium-atomic-only.AllowedFnsRegex for whitelisted paths that are allowed to take atomic pointers.elysium-atomic-only.ParamAnnotAnnotation that allows an atomic to be derefed as a parameter.elysium-atomic-only.TypeAnnotAnnotation that marks a variable, member, etc as an atomic.elysium-global-prefix.PrefixPrefix that must be used by globals and may not be used by any other symbol (defaultg_).elysium-header-namespace.HeaderSuffixesSemicolon- or comma-separated list of header extensions that should be checked (default.h;.hh;.hpp).elysium-header-namespace.SpecialDirectoryPrefixesOptional semicolon- or comma-separated list describing directory-specific prefix overrides. Each entry isrelative/path:prefix_and, if the header being checked lives within that path (longest match wins), the provided prefix is prepended before the header stem. The suffix_is not implied; include whatever separator you prefer. When casing rules demand uppercase (e.g. macros), the directory prefix is uppercased automatically to match.elysium-header-namespace.SpecialGlobalPrefixesOptional semicolon- or comma-separated list of extra prefixes that may appear before any header-derived prefix. Each entry is treated literally (aside from automatic lower/upper variants to follow casing rules) and may itself include underscores.
The header namespace check automatically derives its lower/upper casing preferences from the corresponding readability-identifier-naming.*Case options (falling back to lowercase when they are unset), so you only need to configure casing once. Parameters, members, and other local declarations are ignored by this check.
Macros that are defined and undefined within the same header are exempt from the namespace rule; they may use any name because the check can prove they do not leak beyond the header.