]> granicus.if.org Git - clang/commit
Perform array bounds checking in more situations and properly handle special
authorKaelyn Uhrain <rikka@google.com>
Fri, 5 Aug 2011 23:18:04 +0000 (23:18 +0000)
committerKaelyn Uhrain <rikka@google.com>
Fri, 5 Aug 2011 23:18:04 +0000 (23:18 +0000)
commitd6c8865e6f306556b7eef972ceec2cc8ba026a0d
treeb0391b68d4b12d90d9fbda7d2a144eb2ab29bf45
parentde91db51c1488b14a7a23b24d8a81dce1ec63f4f
Perform array bounds checking in more situations and properly handle special
case situations with the unary operators & and *. Also extend the array bounds
checking to work with pointer arithmetic; the pointer arithemtic checking can
be turned on using -Warray-bounds-pointer-arithmetic.

The changes to where CheckArrayAccess gets called is based on some trial &
error and a bunch of digging through source code and gdb backtraces in order
to have the check performed under as many situations as possible (such as for
variable initializers, arguments to function calls, and within conditional in
addition to the simpler cases of the operands to binary and unary operator)
while not being called--and triggering warnings--more than once for a given
ArraySubscriptExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136997 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/DiagnosticSemaKinds.td
include/clang/Sema/Sema.h
lib/Sema/SemaChecking.cpp
lib/Sema/SemaExpr.cpp
lib/Sema/SemaExprCXX.cpp
test/SemaCXX/array-bounds.cpp