Skip to content

Conversation

@vbvictor
Copy link
Contributor

@vbvictor vbvictor commented Dec 6, 2025

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Dec 6, 2025

@llvm/pr-subscribers-clang-tools-extra

@llvm/pr-subscribers-clang-tidy

Author: Baranov Victor (vbvictor)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/170977.diff

3 Files Affected:

  • (modified) clang-tools-extra/clang-tidy/.clang-tidy (+4)
  • (modified) clang-tools-extra/clang-tidy/bugprone/UnsafeFunctionsCheck.cpp (+2-2)
  • (modified) clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp (+1-1)
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");
     }

@vbvictor vbvictor merged commit 0e5fd43 into llvm:main Dec 6, 2025
14 checks passed
@vbvictor vbvictor deleted the acp/vbvictor/2445388486306334 branch December 6, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants