Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -1151,7 +1151,8 @@ const Expr *ArgExpr, SourceLocation CallSiteLoc) { if (CheckNonNullExpr(S, ArgExpr)) - S.Diag(CallSiteLoc, diag::warn_null_arg) << ArgExpr->getSourceRange(); + S.DiagRuntimeBehavior(CallSiteLoc, ArgExpr, + S.PDiag(diag::warn_null_arg) << ArgExpr->getSourceRange()); } bool Sema::GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx) { Index: test/Sema/non-null-warning.c =================================================================== --- test/Sema/non-null-warning.c +++ test/Sema/non-null-warning.c @@ -37,6 +37,9 @@ return 0; // expected-warning {{null returned from function that requires a non-null return value}} } +#define SAFE_CALL(X) if (X) foo(X) int main () { foo(0); // expected-warning {{null passed to a callee that requires a non-null argument}} + (void)sizeof(foo(0)); // expect no diagnostic in unevaluated context. + SAFE_CALL(0); // expect no diagnostic for unreachable code. }