aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2014-07-23 11:49:46 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2014-07-23 11:49:46 +0000
commitda3658e2b7f59c8a32f815f3309b61ef1a86c86b (patch)
tree1ade76ef628cd028d2104fce384bcfc2a8b7ac74 /clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
parent7664558efcfb8cf53e1f4d599c01500e09a5a406 (diff)
downloadllvm-da3658e2b7f59c8a32f815f3309b61ef1a86c86b.zip
llvm-da3658e2b7f59c8a32f815f3309b61ef1a86c86b.tar.gz
llvm-da3658e2b7f59c8a32f815f3309b61ef1a86c86b.tar.bz2
Reapply r213647 with a fix.
ASTMatchers currently have problems mixing bound TypeLoc nodes with Decl/Stmt nodes. That should be fixed soon but for this checker there we only need the TypeLoc to generate a fixit so postpone the potentially heavyweight AST walking until after we know that we're going to emit a warning. This is covered by existing test cases. Original message: [clang-tidy] Add a check for RAII temporaries. This tries to find code similar that immediately destroys an object that looks like it's trying to follow RAII. { scoped_lock(&global_mutex); critical_section(); } This checker will have false positives if someone uses this pattern to legitimately invoke a destructor immediately (or the statement is at the end of a scope anyway). To reduce the number we ignore this pattern in macros (this is heavily used by gtest) and ignore objects with no user-defined destructor. llvm-svn: 213738
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
index 669ad08..e3dbdc3 100644
--- a/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp
@@ -14,6 +14,7 @@
#include "BoolPointerImplicitConversion.h"
#include "RedundantSmartptrGet.h"
#include "SwappedArgumentsCheck.h"
+#include "UnusedRAII.h"
#include "UseOverride.h"
namespace clang {
@@ -35,6 +36,9 @@ public:
"misc-swapped-arguments",
new ClangTidyCheckFactory<SwappedArgumentsCheck>());
CheckFactories.addCheckFactory(
+ "misc-unused-raii",
+ new ClangTidyCheckFactory<UnusedRAIICheck>());
+ CheckFactories.addCheckFactory(
"misc-use-override",
new ClangTidyCheckFactory<UseOverride>());
}