[all-commits] [llvm/llvm-project] 71b81e: [alpha.webkit.UncountedLocalVarsChecker] Recursive...

Ryosuke Niwa via All-commits all-commits at lists.llvm.org
Thu Oct 17 16:52:52 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 71b81e93d28c8db3f9cfa1d715c925a98ae4b153
      https://github.com/llvm/llvm-project/commit/71b81e93d28c8db3f9cfa1d715c925a98ae4b153
  Author: Ryosuke Niwa <rniwa at webkit.org>
  Date:   2024-10-17 (Thu, 17 Oct 2024)

  Changed paths:
    M clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp
    M clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp

  Log Message:
  -----------
  [alpha.webkit.UncountedLocalVarsChecker] Recursive functions are erroneously treated as non-trivial (#110973)

This PR fixes the bug that alpha.webkit.UncountedLocalVarsChecker
erroneously treats a trivial recursive function as non-trivial. This was
caused by TrivialFunctionAnalysis::isTrivialImpl which takes a statement
as an argument populating the cache with "false" while traversing the
statement to determine its triviality within a recursive function in
TrivialFunctionAnalysisVisitor's WithCachedResult. Because
IsFunctionTrivial honors an entry in the cache, this resulted in the
whole function to be treated as non-trivial.

Thankfully, TrivialFunctionAnalysisVisitor::IsFunctionTrivial already
handles recursive functions correctly so this PR applies the same logic
to TrivialFunctionAnalysisVisitor::WithCachedResult by sharing code
between the two functions. This avoids the cache to be pre-populated
with "false" while traversing statements in a recurisve function.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list