diff options
author | Alexander Kornienko <alexfh@google.com> | 2015-03-02 10:46:43 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2015-03-02 10:46:43 +0000 |
commit | 1ca3b832558a9843241f940fbd1ed90ec10e5f70 (patch) | |
tree | 618cbc0d0f5c19d79a0a93b133940d0839df938c /clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | |
parent | e662316994ff7f90263c98e5213230fa7823e8d2 (diff) | |
download | llvm-1ca3b832558a9843241f940fbd1ed90ec10e5f70.zip llvm-1ca3b832558a9843241f940fbd1ed90ec10e5f70.tar.gz llvm-1ca3b832558a9843241f940fbd1ed90ec10e5f70.tar.bz2 |
[clang-tidy] Assert related checkers
This patch contains two assert related checkers. These checkers are the part of
those that is being open sourced by Ericsson
(http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-December/040520.html).
The checkers:
AssertSideEffect:
/// \brief Finds \c assert() with side effect.
///
/// The conition of \c assert() is evaluated only in debug builds so a condition
/// with side effect can cause different behaviour in debug / relesase builds.
StaticAssert:
/// \brief Replaces \c assert() with \c static_assert() if the condition is
/// evaluatable at compile time.
///
/// The condition of \c static_assert() is evaluated at compile time which is
/// safer and more efficient.
http://reviews.llvm.org/D7375
Patch by Szabolcs Sipos!
llvm-svn: 230943
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp index a43efab..9c9ff70 100644 --- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp @@ -11,10 +11,12 @@ #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" #include "ArgumentCommentCheck.h" +#include "AssertSideEffectCheck.h" #include "AssignOperatorSignatureCheck.h" #include "BoolPointerImplicitConversion.h" #include "InaccurateEraseCheck.h" #include "InefficientAlgorithmCheck.h" +#include "StaticAssertCheck.h" #include "SwappedArgumentsCheck.h" #include "UndelegatedConstructor.h" #include "UniqueptrResetRelease.h" @@ -28,6 +30,8 @@ class MiscModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { CheckFactories.registerCheck<ArgumentCommentCheck>("misc-argument-comment"); + CheckFactories.registerCheck<AssertSideEffectCheck>( + "misc-assert-side-effect"); CheckFactories.registerCheck<AssignOperatorSignatureCheck>( "misc-assign-operator-signature"); CheckFactories.registerCheck<BoolPointerImplicitConversion>( @@ -36,6 +40,8 @@ public: "misc-inaccurate-erase"); CheckFactories.registerCheck<InefficientAlgorithmCheck>( "misc-inefficient-algorithm"); + CheckFactories.registerCheck<StaticAssertCheck>( + "misc-static-assert"); CheckFactories.registerCheck<SwappedArgumentsCheck>( "misc-swapped-arguments"); CheckFactories.registerCheck<UndelegatedConstructorCheck>( |