[all-commits] [llvm/llvm-project] 025541: [analyzer] Relax assertion in BugReporterVisitors....

Balazs Benics via All-commits all-commits at lists.llvm.org
Thu Jan 30 03:48:31 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 025541ddedd23e39d9394ea8a1e41a64dfbe4e94
      https://github.com/llvm/llvm-project/commit/025541ddedd23e39d9394ea8a1e41a64dfbe4e94
  Author: Balazs Benics <benicsbalazs at gmail.com>
  Date:   2025-01-30 (Thu, 30 Jan 2025)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
    M clang/test/Analysis/null-deref-path-notes.cpp

  Log Message:
  -----------
  [analyzer] Relax assertion in BugReporterVisitors.cpp isInitializationOfVar (#125044)

If we see a variable declaration (aka. DeclStmt), and the VarRegion it
declared doesn't have Stack memspace, we assumed that it must be a local
static variable.
However, the declared variable may be an extern declaration of a global.

In this patch, let's admit that local extern declarations are a thing.

For the sake of completeness, I also added one more test for
thread_locals - which are implicitly considered statics btw. (the
`isStaticLocal()` correctly also considers thread locals as local
statics).

Fixes #124975



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