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/docs/clang-tidy | |
| 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/docs/clang-tidy')
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst | 9 | ||||
| -rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/list.rst | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst new file mode 100644 index 00000000000..93c84dc7e3e --- /dev/null +++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-pro-bounds-array-to-pointer-decay.rst @@ -0,0 +1,9 @@ +cppcoreguidelines-pro-bounds-array-to-pointer-decay +=================================================== + +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 diff --git a/clang-tools-extra/docs/clang-tidy/checks/list.rst b/clang-tools-extra/docs/clang-tidy/checks/list.rst index 94dd68cc7e6..3551abced3e 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/list.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/list.rst @@ -4,6 +4,7 @@ List of clang-tidy Checks .. toctree:: cert-setlongjmp cert-variadic-function-def + cppcoreguidelines-pro-bounds-array-to-pointer-decay cppcoreguidelines-pro-bounds-pointer-arithmetic cppcoreguidelines-pro-type-const-cast cppcoreguidelines-pro-type-reinterpret-cast |

