[analyzer] Warn on passing a reference to null pointer as an argument in a call
authorAnna Zaks <ganna@apple.com>
Thu, 7 Mar 2013 03:02:36 +0000 (03:02 +0000)
committerAnna Zaks <ganna@apple.com>
Thu, 7 Mar 2013 03:02:36 +0000 (03:02 +0000)
commit9e0da9e0702440c74f02eb6419ca315d3d6b3255
treedac1da8df618cd5c411d5cfadd21054f97683263
parent1fb7c625d06d7ce49bd179c35c6414388f060d34
[analyzer] Warn on passing a reference to null pointer as an argument in a call

Warn about null pointer dereference earlier when a reference to a null pointer is
passed in a call. The idea is that even though the standard might allow this, reporting
the issue earlier is better for diagnostics (the error is reported closer to the place where
the pointer was set to NULL). This also simplifies analyzer’s diagnostic logic, which has
to track “where the null came from”. As a consequence, some of our null pointer
warning suppression mechanisms started triggering more often.

TODO: Change the name of the file and class to reflect the new check.
llvm-svn: 176612
clang/lib/StaticAnalyzer/Checkers/AttrNonNullChecker.cpp
clang/test/Analysis/initializer.cpp
clang/test/Analysis/reference.cpp