[clang-tidy] Assert related checkers
authorAlexander Kornienko <alexfh@google.com>
Mon, 2 Mar 2015 10:46:43 +0000 (10:46 +0000)
committerAlexander Kornienko <alexfh@google.com>
Mon, 2 Mar 2015 10:46:43 +0000 (10:46 +0000)
commit1ca3b832558a9843241f940fbd1ed90ec10e5f70
tree618cbc0d0f5c19d79a0a93b133940d0839df938c
parente662316994ff7f90263c98e5213230fa7823e8d2
[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
clang-tools-extra/clang-tidy/misc/AssertSideEffectCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/AssertSideEffectCheck.h [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/CMakeLists.txt
clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
clang-tools-extra/clang-tidy/misc/StaticAssertCheck.cpp [new file with mode: 0644]
clang-tools-extra/clang-tidy/misc/StaticAssertCheck.h [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/misc-assert-side-effect.cpp [new file with mode: 0644]
clang-tools-extra/test/clang-tidy/misc-static-assert.cpp [new file with mode: 0644]