[all-commits] [llvm/llvm-project] 6078f5: Reland [Clang][analyzer] replace Stmt* with ConstC...

Fangyi Zhou via All-commits all-commits at lists.llvm.org
Mon May 12 05:20:06 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6078f5eb214d4cbb74ca9b024b88ff88d963ffd2
      https://github.com/llvm/llvm-project/commit/6078f5eb214d4cbb74ca9b024b88ff88d963ffd2
  Author: Fangyi Zhou <me at fangyi.io>
  Date:   2025-05-12 (Mon, 12 May 2025)

  Changed paths:
    M clang/include/clang/Analysis/CFG.h
    M clang/include/clang/StaticAnalyzer/Checkers/SValExplainer.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/LoopWidening.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/Store.h
    M clang/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h
    M clang/lib/Analysis/CFG.cpp
    M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/ErrnoModeling.h
    M clang/lib/StaticAnalyzer/Checkers/Iterator.cpp
    M clang/lib/StaticAnalyzer/Checkers/Iterator.h
    M clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/STLAlgorithmModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp
    M clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
    M clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
    M clang/lib/StaticAnalyzer/Core/CallEvent.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngineObjC.cpp
    M clang/lib/StaticAnalyzer/Core/LoopWidening.cpp
    M clang/lib/StaticAnalyzer/Core/ProgramState.cpp
    M clang/lib/StaticAnalyzer/Core/RegionStore.cpp
    M clang/lib/StaticAnalyzer/Core/SValBuilder.cpp
    M clang/lib/StaticAnalyzer/Core/SymbolManager.cpp
    A clang/test/Analysis/PR57270.cpp
    M clang/test/Analysis/container-modeling.cpp
    M clang/test/Analysis/dump_egraph.cpp
    M clang/test/Analysis/explain-svals.cpp
    M clang/test/Analysis/explain-svals.m

  Log Message:
  -----------
  Reland [Clang][analyzer] replace Stmt* with ConstCFGElement in SymbolConjured (#137355)

Closes #57270.

This PR changes the `Stmt *` field in `SymbolConjured` with
`CFGBlock::ConstCFGElementRef`. The motivation is that, when conjuring a
symbol, there might not always be a statement available, causing
information to be lost for conjured symbols, whereas the CFGElementRef
can always be provided at the callsite.

Following the idea, this PR changes callsites of functions to create
conjured symbols, and replaces them with appropriate `CFGElementRef`s.

There is a caveat at loop widening, where the correct location is the
CFG terminator (which is not an element and does not have a ref). In
this case, the first element in the block is passed as a location.

Previous PR #128251, Reverted at #137304.



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