[clang-tools-extra] [clang-tidy] Fix `modernize-use-nullptr` crash on 32-bit Windows (PR #160023)

Victor Chernyakin via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 21 19:52:37 PDT 2025


https://github.com/localspook updated https://github.com/llvm/llvm-project/pull/160023

>From 4071d5e2e717d03810ec8d0f7476253d1bb72ee1 Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Sun, 21 Sep 2025 19:15:46 -0700
Subject: [PATCH 1/2] [clang-tidy] Fix `modernize-use-nullptr` crash on 32-bit
 Windows

---
 clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index c38fb3a01d287..782a10420f9cd 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -53,7 +53,7 @@ StatementMatcher makeCastSequenceMatcher(llvm::ArrayRef<StringRef> NameList) {
       unless(hasImplicitDestinationType(
           qualType(matchers::matchesAnyListedTypeName(NameList)))));
 
-  auto IsOrHasDescendant = [](auto InnerMatcher) {
+  auto IsOrHasDescendant = [](const auto &InnerMatcher) {
     return anyOf(InnerMatcher, hasDescendant(InnerMatcher));
   };
 

>From 6ebf497817ca5c2764537cd3832b025a89add48e Mon Sep 17 00:00:00 2001
From: Victor Chernyakin <chernyakin.victor.j at outlook.com>
Date: Sun, 21 Sep 2025 19:52:25 -0700
Subject: [PATCH 2/2] add release notes

---
 clang-tools-extra/docs/ReleaseNotes.rst | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 23d757b5e6f2e..1bec1e6963e06 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -257,6 +257,10 @@ Changes in existing checks
   <clang-tidy/checks/modernize/use-designated-initializers>` check to
   suggest using designated initializers for aliased aggregate types.
 
+- Improved :doc:`modernize-use-nullptr
+  <clang-tidy/checks/modernize/use-nullptr>` check by fixing a crash
+  on Windows when the check was enabled with a 32-bit clang-tidy binary.
+
 - Improved :doc:`modernize-use-std-format
   <clang-tidy/checks/modernize/use-std-format>` check to correctly match
   when the format string is converted to a different type by an implicit



More information about the cfe-commits mailing list