diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index a960b9931ddfd..0b2a74e272339 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -11745,10 +11745,6 @@ static void CheckImplicitArgumentConversions(Sema &S, CallExpr *TheCall, static void DiagnoseNullConversion(Sema &S, Expr *E, QualType T, SourceLocation CC) { - if (S.Diags.isIgnored(diag::warn_impcast_null_pointer_to_integer, - E->getExprLoc())) - return; - // Don't warn on functions which have return type nullptr_t. if (isa(E)) return; @@ -11765,6 +11761,10 @@ static void DiagnoseNullConversion(Sema &S, Expr *E, QualType T, T->isMemberPointerType() || !T->isScalarType() || T->isNullPtrType()) return; + if (S.Diags.isIgnored(diag::warn_impcast_null_pointer_to_integer, + E->getExprLoc())) + return; + SourceLocation Loc = E->getSourceRange().getBegin(); // Venture through the macro stacks to get to the source of macro arguments.