Skip to content

Commit 16d5a3f

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 16d5a3f

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
@@ -31,6 +31,7 @@
3131
#include "UnusedParametersCheck.h"
3232
#include "UnusedUsingDeclsCheck.h"
3333
#include "UseAnonymousNamespaceCheck.h"
34+
#include "UseConstexprCheck.h"
3435
#include "UseInternalLinkageCheck.h"
3536

3637
namespace clang::tidy {
@@ -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)