Skip to content

Commit 8d35424

Browse files
committed
[clang-tidy] add misc-constexpr check
This check finds all functions and variables that can be declared as `constexpr`, using the specified standard version to check if the requirements are met. Fixes #115622
1 parent 42e7796 commit 8d35424

File tree

8 files changed

+1631
-0
lines changed

8 files changed

+1631
-0
lines changed

clang-tools-extra/clang-tidy/misc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ set_target_properties(genconfusable PROPERTIES FOLDER "Clang Tools Extra/Sourceg
1919

2020
add_clang_library(clangTidyMiscModule STATIC
2121
ConstCorrectnessCheck.cpp
22+
UseConstexprCheck.cpp
2223
CoroutineHostileRAIICheck.cpp
2324
DefinitionsInHeadersCheck.cpp
2425
ConfusableIdentifierCheck.cpp

clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "../ClangTidyModuleRegistry.h"
1212
#include "ConfusableIdentifierCheck.h"
1313
#include "ConstCorrectnessCheck.h"
14+
#include "UseConstexprCheck.h"
1415
#include "CoroutineHostileRAIICheck.h"
1516
#include "DefinitionsInHeadersCheck.h"
1617
#include "HeaderIncludeCycleCheck.h"
@@ -43,6 +44,7 @@ class MiscModule : public ClangTidyModule {
4344
"misc-confusable-identifiers");
4445
CheckFactories.registerCheck<ConstCorrectnessCheck>(
4546
"misc-const-correctness");
47+
CheckFactories.registerCheck<UseConstexprCheck>("misc-use-constexpr");
4648
CheckFactories.registerCheck<CoroutineHostileRAIICheck>(
4749
"misc-coroutine-hostile-raii");
4850
CheckFactories.registerCheck<DefinitionsInHeadersCheck>(

0 commit comments

Comments
 (0)