https://github.com/higher-performance created https://github.com/llvm/llvm-project/pull/132816
`nullptr` is not supported on earlier versions of either standard, so the tidy should not diagnose earlier uses. >From d9e38b44a4fbcea9800b14ec3fb0aba814d05722 Mon Sep 17 00:00:00 2001 From: higher-performance <higher.performance.git...@gmail.com> Date: Mon, 24 Mar 2025 15:16:58 -0400 Subject: [PATCH] Limit modernize-use-nullptr to C++11/C23 and later `nullptr` is not supported on earlier versions of either standard, so the tidy should not diagnose earlier uses. --- clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp index 108717e151b57..771ea3875a71a 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp @@ -505,7 +505,10 @@ void UseNullptrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) { } void UseNullptrCheck::registerMatchers(MatchFinder *Finder) { - Finder->addMatcher(makeCastSequenceMatcher(IgnoredTypes), this); + // nullptr is supported starting from C++11 and C23. + if (getLangOpts().CPlusPlus11 || getLangOpts().C23) { + Finder->addMatcher(makeCastSequenceMatcher(IgnoredTypes), this); + } } void UseNullptrCheck::check(const MatchFinder::MatchResult &Result) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits