aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-22 19:44:17 +0200
committerGitHub <noreply@github.com>2025-05-22 19:44:17 +0200
commit827027b3a39d5c43f6fa74cf8761f974bf125611 (patch)
treeafee32c02336349bbd7ded117beaf367d62e294f
parenta40762cd78d5d254d2298d74ead839732f4c8b7f (diff)
downloadllvm-827027b3a39d5c43f6fa74cf8761f974bf125611.zip
llvm-827027b3a39d5c43f6fa74cf8761f974bf125611.tar.gz
llvm-827027b3a39d5c43f6fa74cf8761f974bf125611.tar.bz2
[clang] Move Diags.isIgnored() check below faster checks (#141084)
Because this check is relatively slow and the others aren't as much. http://llvm-compile-time-tracker.com/compare.php?from=4a158f675be7fd1b3763bf39980d801db89744f8&to=886a8fab041ff7574d54cccddbc1a9b968c1bb58&stat=instructions:u
-rw-r--r--clang/lib/Sema/SemaChecking.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index a960b99..0b2a74e 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<CallExpr>(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.