aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/bugprone
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-05-23 07:58:41 +0000
committerClement Courbet <courbet@google.com>2018-05-23 07:58:41 +0000
commit27932c0b1b0d1ba73a7ab597c8d52cb75f892e40 (patch)
tree7dbab3c9083130f4ffd12d7ba3e5eeaa892e77ec /clang-tidy/bugprone
parent7145b91d2293a3f5385e40745087ac953e8c8a7f (diff)
[clang-tidy] new cppcoreguidelines-narrowing-conversions check.
Summary: Checks for narrowing conversions, e.g. int i = 0; i += 0.1; This has what some might consider false positives for: i += ceil(d); Reviewers: alexfh, hokein Subscribers: srhines, nemanjai, mgorny, JDevlieghere, xazax.hun, kbarton Differential Revision: https://reviews.llvm.org/D38455 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@333066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'clang-tidy/bugprone')
-rw-r--r--clang-tidy/bugprone/BugproneTidyModule.cpp3
-rw-r--r--clang-tidy/bugprone/CMakeLists.txt1
2 files changed, 4 insertions, 0 deletions
diff --git a/clang-tidy/bugprone/BugproneTidyModule.cpp b/clang-tidy/bugprone/BugproneTidyModule.cpp
index b87961e0..86eb9d1b 100644
--- a/clang-tidy/bugprone/BugproneTidyModule.cpp
+++ b/clang-tidy/bugprone/BugproneTidyModule.cpp
@@ -10,6 +10,7 @@
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "../ClangTidyModuleRegistry.h"
+#include "../cppcoreguidelines/NarrowingConversionsCheck.h"
#include "ArgumentCommentCheck.h"
#include "AssertSideEffectCheck.h"
#include "BoolPointerImplicitConversionCheck.h"
@@ -92,6 +93,8 @@ public:
"bugprone-move-forwarding-reference");
CheckFactories.registerCheck<MultipleStatementMacroCheck>(
"bugprone-multiple-statement-macro");
+ CheckFactories.registerCheck<cppcoreguidelines::NarrowingConversionsCheck>(
+ "bugprone-narrowing-conversions");
CheckFactories.registerCheck<ParentVirtualCallCheck>(
"bugprone-parent-virtual-call");
CheckFactories.registerCheck<SizeofContainerCheck>(
diff --git a/clang-tidy/bugprone/CMakeLists.txt b/clang-tidy/bugprone/CMakeLists.txt
index 64b1e32d..3cce0131 100644
--- a/clang-tidy/bugprone/CMakeLists.txt
+++ b/clang-tidy/bugprone/CMakeLists.txt
@@ -48,6 +48,7 @@ add_clang_library(clangTidyBugproneModule
clangBasic
clangLex
clangTidy
+ clangTidyCppCoreGuidelinesModule
clangTidyUtils
clangTooling
)