[PATCH] D118743: [clang-tidy] Add `modernize-use-inline-const-variables-in-headers` check

Evgeny Shulgin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 1 16:01:30 PST 2022


Izaron created this revision.
Izaron added reviewers: alexfh, rsmith, LegalizeAdulthood.
Herald added subscribers: carlosgalvezp, xazax.hun, mgorny.
Izaron requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

C++17 `inline variables` are far more convenient compared with
extern const variables declarations, and in general are more ODR-safe and
memory efficient compared with non-inline const variables definitions.
It is a part of a number of code styles to use C++17 `inline variables`.
The checker would help users to follow this code style.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118743

Files:
  clang-tools-extra/clang-tidy/modernize/CMakeLists.txt
  clang-tools-extra/clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tools-extra/clang-tidy/modernize/UseInlineConstVariablesInHeadersCheck.cpp
  clang-tools-extra/clang-tidy/modernize/UseInlineConstVariablesInHeadersCheck.h
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/modernize-use-inline-const-variables-in-headers.rst
  clang-tools-extra/test/clang-tidy/checkers/modernize-use-inline-const-variables-in-headers.hpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118743.405116.patch
Type: text/x-patch
Size: 14877 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220202/6294d792/attachment-0001.bin>


More information about the cfe-commits mailing list