[clang] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions (PR #90733)
Mikhail R. Gadelha via cfe-commits
cfe-commits at lists.llvm.org
Wed May 1 07:30:13 PDT 2024
https://github.com/mikhailramalho created https://github.com/llvm/llvm-project/pull/90733
As per the guidelines, trivial inline functions shouldn't be changed to adopt smart pointers.
>From a8c7e012a576fd01d6a6bdcb23a43e6669b005e8 Mon Sep 17 00:00:00 2001
From: "Mikhail R. Gadelha" <mikhail at igalia.com>
Date: Wed, 1 May 2024 11:23:11 -0300
Subject: [PATCH] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on
inlined functions
As per the guidelines, trivial inline functions shouldn't be changed to
adopt smart pointers
---
.../Checkers/WebKit/UncountedLocalVarsChecker.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
index 6036ad58cf253c..f64e29089f0b78 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp
@@ -178,6 +178,11 @@ class UncountedLocalVarsChecker
if (shouldSkipVarDecl(V))
return;
+ if (auto *FD = dyn_cast<FunctionDecl>(V->getDeclContext())) {
+ if (FD->isInlined())
+ return;
+ }
+
const auto *ArgType = V->getType().getTypePtr();
if (!ArgType)
return;
More information about the cfe-commits
mailing list