[all-commits] [llvm/llvm-project] 0342d2: [NFC][analyzer] Refactor Environment to map Expr t...

tigbr via All-commits all-commits at lists.llvm.org
Tue Apr 28 05:17:59 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0342d2f10d0bcf84108f879aaf55a7414653a102
      https://github.com/llvm/llvm-project/commit/0342d2f10d0bcf84108f879aaf55a7414653a102
  Author: tigbr <gabor.tothvari at ericsson.com>
  Date:   2026-04-28 (Tue, 28 Apr 2026)

  Changed paths:
    M clang/include/clang/StaticAnalyzer/Checkers/Taint.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
    M clang/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
    M clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
    M clang/lib/StaticAnalyzer/Checkers/Taint.cpp
    M clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp
    M clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
    M clang/lib/StaticAnalyzer/Core/Environment.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp

  Log Message:
  -----------
  [NFC][analyzer] Refactor Environment to map Expr to SVal instead of Stmt to SVal (#193295)

Previously the `Environment` mapped `{Stmt *, LocationContext}` pairs to
symbolic values; but semantically it represents the values produced by
the evaluation of _expressions_, so there was no good reason to use
non-`Expr` statements in this mapping.

This commit replaces `Stmt` with `Expr` (its subclass) in this mapping
to accurately represent the actually relevant type.

This change is also propagated to methods, variables etc. that handle
the `Environment`.

There was a special case in `Environment::getSVal` that allowed looking
up a `ReturnStmt` in the `Environment` (and translated this to a lookup
of the "return value" sub-expression of the `ReturnStmt`). This commit
eliminates this and modifies the callers to explicitly look up the
sub-expression of the `ReturnStmt`.



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