This patch makes clang issue a warning when a null constant is used in a context where a non null expression is expected. For example:
int * _Nonnull p0 = 0; // warning expected here int * _Nonnull p1; int * _Nonnull p2 = c ? p1 : 0; // warning expected here
A new function Sema::diagnoseNullPtrToNonnullCast is defined, which checks whether a null pointer constant is being cast to a _Nonnull pointer type, and called before ImplicitCastExprs are created.
rdar://problem/24724255
rdar://problem/22074116
Nitpick: Using "const" here makes me think of the qualifier. Is there a reason not to just spell out "constant"?