From 4241cedb68d61d85dd12b64d6792d0277f9ff4b2 Mon Sep 17 00:00:00 2001 From: Matthias Gehre Date: Thu, 26 Nov 2015 22:32:11 +0000 Subject: [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic: ignore generated pointer arithmetic Summary: Inside a range-based for-loop over an array, the compiler generates pointer arithmetic (end = array + size). Don't flag this. Reviewers: alexfh, sbenza, bkramer, aaron.ballman Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D14582 llvm-svn: 254182 --- .../test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp') diff --git a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp index c8fea8052e5..7cbc6ddf96a 100644 --- a/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp +++ b/clang-tools-extra/test/clang-tidy/cppcoreguidelines-pro-bounds-pointer-arithmetic.cpp @@ -84,4 +84,6 @@ void okay() { i = j - 1; auto diff = p - q; // OK, result is arithmetic + + for(int ii : a) ; // OK, pointer arithmetic generated by compiler } -- cgit v1.2.3