diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-03-21 19:01:17 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-03-21 19:01:17 +0000 |
commit | 163e7166d7ab777447ad0b6c9154f4ef91a24b6c (patch) | |
tree | 223812530a830926d821114ded828f8d8690c79f /clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp | |
parent | 9c1e310c16659deb3984df16376263471a129400 (diff) | |
download | bcm5719-llvm-163e7166d7ab777447ad0b6c9154f4ef91a24b6c.tar.gz bcm5719-llvm-163e7166d7ab777447ad0b6c9154f4ef91a24b6c.zip |
Prevent cppcoreguidelines-pro-bounds-array-to-pointer-decay from diagnosing array to pointer decay stemming from system macros.
Patch by Breno Rodrigues Guimaraes.
llvm-svn: 298421
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp index ce192805dda..22d98bcd121 100644 --- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp +++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-array-to-pointer-decay.cpp @@ -1,4 +1,5 @@ // RUN: %check_clang_tidy %s cppcoreguidelines-pro-bounds-array-to-pointer-decay %t +#include <assert.h> #include <stddef.h> namespace gsl { @@ -34,6 +35,11 @@ void f() { for (auto &e : a) // OK, iteration internally decays array to pointer e = 1; + + assert(false); // OK, array decay inside system header macro + + assert(a); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay] } const char *g() { |