[PATCH] D129683: [Sema] Move Diags.isIgnored() checks off hot paths, it's not free. NFC
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 7 07:18:43 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG897f3ddc6154: [Sema] Move Diags.isIgnored() checks off hot paths, it's not free. NFC (authored by sammccall).
Changed prior to commit:
https://reviews.llvm.org/D129683?vs=444375&id=458448#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129683/new/
https://reviews.llvm.org/D129683
Files:
clang/lib/Sema/Sema.cpp
Index: clang/lib/Sema/Sema.cpp
===================================================================
--- clang/lib/Sema/Sema.cpp
+++ clang/lib/Sema/Sema.cpp
@@ -575,10 +575,7 @@
Diag(Loc, diag::warn_nullability_lost) << SrcType << DstType;
}
-void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr* E) {
- if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant,
- E->getBeginLoc()))
- return;
+void Sema::diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E) {
// nullptr only exists from C++11 on, so don't warn on its absence earlier.
if (!getLangOpts().CPlusPlus11)
return;
@@ -588,6 +585,10 @@
if (E->IgnoreParenImpCasts()->getType()->isNullPtrType())
return;
+ if (Diags.isIgnored(diag::warn_zero_as_null_pointer_constant,
+ E->getBeginLoc()))
+ return;
+
// Don't diagnose the conversion from a 0 literal to a null pointer argument
// in a synthesized call to operator<=>.
if (!CodeSynthesisContexts.empty() &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129683.458448.patch
Type: text/x-patch
Size: 1029 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220907/97c7d8d9/attachment.bin>
More information about the cfe-commits
mailing list