[clang] [alpha.webkit.UncountedLocalVarsChecker] Don't warning on inlined functions (PR #90733)

via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 07:30:42 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Mikhail R. Gadelha (mikhailramalho)

<details>
<summary>Changes</summary>

As per the guidelines, trivial inline functions shouldn't be changed to adopt smart pointers.

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


1 Files Affected:

- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp (+5) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/90733


More information about the cfe-commits mailing list