diff options
author | Matthias Gehre <M.Gehre@gmx.de> | 2015-10-26 21:56:02 +0000 |
---|---|---|
committer | Matthias Gehre <M.Gehre@gmx.de> | 2015-10-26 21:56:02 +0000 |
commit | f33319699dbf6f4a7b2f0e816b01d719706ea0b1 (patch) | |
tree | 8611000af3126e050cb9cf76d7fbcbb6bfb6cdb4 /clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp | |
parent | e9b500f722e1497ad83baacfe21057993ff44ed3 (diff) | |
download | bcm5719-llvm-f33319699dbf6f4a7b2f0e816b01d719706ea0b1.tar.gz bcm5719-llvm-f33319699dbf6f4a7b2f0e816b01d719706ea0b1.zip |
[clang-tidy] Add new check cppcoreguidelines-pro-bounds-array-to-pointer-decay
Summary:
This check flags all array to pointer decays.
Pointers should not be used as arrays. array_view is a bounds-checked,
safe alternative to using pointers to access arrays.
This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds3-no-array-to-pointer-decay
Reviewers: alexfh, sbenza, bkramer, aaron.ballman
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D13640
llvm-svn: 251358
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp index 9929d66e780..d77954b51a1 100644 --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp @@ -11,6 +11,7 @@ #include "../ClangTidyModule.h" #include "../ClangTidyModuleRegistry.h" #include "../misc/AssignOperatorSignatureCheck.h" +#include "ProBoundsArrayToPointerDecayCheck.h" #include "ProBoundsPointerArithmeticCheck.h" #include "ProTypeConstCastCheck.h" #include "ProTypeReinterpretCastCheck.h" @@ -26,6 +27,8 @@ namespace cppcoreguidelines { class CppCoreGuidelinesModule : public ClangTidyModule { public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { + CheckFactories.registerCheck<ProBoundsArrayToPointerDecayCheck>( + "cppcoreguidelines-pro-bounds-array-to-pointer-decay"); CheckFactories.registerCheck<ProBoundsPointerArithmeticCheck>( "cppcoreguidelines-pro-bounds-pointer-arithmetic"); CheckFactories.registerCheck<ProTypeConstCastCheck>( |