]> granicus.if.org Git - clang/commit
Add test cases for false positives on -Wnull-arithmetic from Richard
authorChandler Carruth <chandlerc@gmail.com>
Sun, 19 Jun 2011 09:05:14 +0000 (09:05 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 19 Jun 2011 09:05:14 +0000 (09:05 +0000)
commit2af68e4761ed30181540dafb5572993daffa4910
treea53c7e2d4eaf30c6511feb0524827b53d470e982
parente3d49b44ad0596b2998ecf2e7ca78d59188920e5
Add test cases for false positives on -Wnull-arithmetic from Richard
Trieu, and fix them by checking for array and function types as well as
pointer types.

I've added a predicate method on Type to bundle together the logic we're
using here: isPointerLikeType(). I'd welcome better names for this
predicate, this is the best I came up with. It's implemented as a switch
to be a touch lighter weight than all the chained isa<...> casts that
would result otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133383 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Type.h
lib/AST/Type.cpp
lib/Sema/SemaExpr.cpp
test/SemaCXX/null_in_arithmetic_ops.cpp
test/SemaCXX/nullptr_in_arithmetic_ops.cpp