https://github.com/vbvictor created 
https://github.com/llvm/llvm-project/pull/170977

None

>From e767f73f3bed038aea881abd656297375bcd9cf0 Mon Sep 17 00:00:00 2001
From: Victor Baranov <[email protected]>
Date: Sat, 6 Dec 2025 13:58:14 +0300
Subject: [PATCH] [clang-tidy][NFC] Add a few cppcoreguidelines checks to
 codebase

---
 clang-tools-extra/clang-tidy/.clang-tidy                      | 4 ++++
 .../clang-tidy/bugprone/UnsafeFunctionsCheck.cpp              | 4 ++--
 clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp         | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/clang-tidy/.clang-tidy 
b/clang-tools-extra/clang-tidy/.clang-tidy
index 576b4a7b8443e..a29ee52379597 100644
--- a/clang-tools-extra/clang-tidy/.clang-tidy
+++ b/clang-tools-extra/clang-tidy/.clang-tidy
@@ -9,6 +9,10 @@ Checks: >
   -bugprone-narrowing-conversions,
   -bugprone-unchecked-optional-access,
   -bugprone-unused-return-value,
+  cppcoreguidelines-init-variables,
+  cppcoreguidelines-missing-std-forward,
+  cppcoreguidelines-rvalue-reference-param-not-moved,
+  cppcoreguidelines-virtual-class-destructor,
   misc-const-correctness,
   modernize-*,
   -modernize-avoid-c-arrays,
diff --git a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
index 67d0931003c54..0a7467a0ea650 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp
@@ -266,8 +266,8 @@ void UnsafeFunctionsCheck::registerMatchers(MatchFinder 
*Finder) {
 }
 
 void UnsafeFunctionsCheck::check(const MatchFinder::MatchResult &Result) {
-  const Expr *SourceExpr;
-  const FunctionDecl *FuncDecl;
+  const Expr *SourceExpr = nullptr;
+  const FunctionDecl *FuncDecl = nullptr;
 
   if (const auto *DeclRef = Result.Nodes.getNodeAs<DeclRefExpr>(DeclRefId)) {
     SourceExpr = DeclRef;
diff --git a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp 
b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
index 09adbf1155e62..ab584cb66a523 100644
--- a/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp
@@ -199,7 +199,7 @@ void UseRangesCheck::check(const MatchFinder::MatchResult 
&Result) {
     if (!NodeStr.consume_front(FuncDecl))
       continue;
     Function = Value.get<FunctionDecl>();
-    size_t Index;
+    size_t Index = 0;
     if (NodeStr.getAsInteger(10, Index)) {
       llvm_unreachable("Unable to extract replacer index");
     }

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to