[all-commits] [llvm/llvm-project] 1b6b4d: [analyzer] Loop should contain CXXForRangeStmt (#7...

Qizhi Hu via All-commits all-commits at lists.llvm.org
Thu Oct 26 06:12:04 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b6b4d6a08321fb914127dadcd6677dcd9b1b222
      https://github.com/llvm/llvm-project/commit/1b6b4d6a08321fb914127dadcd6677dcd9b1b222
  Author: Qizhi Hu <836744285 at qq.com>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/lib/StaticAnalyzer/Core/LoopWidening.cpp
    M clang/test/Analysis/loop-widening-notes.cpp

  Log Message:
  -----------
  [analyzer] Loop should contain CXXForRangeStmt (#70190)

Static analyze can't report diagnose when statement after a
CXXForRangeStmt and enable widen, because
`ExprEngine::processCFGBlockEntrance` lacks of CXXForRangeStmt and when
`AMgr.options.maxBlockVisitOnPath - 1` equals to `blockCount`, it can't
widen. After next iteration, `BlockCount >=
AMgr.options.maxBlockVisitOnPath` holds and generate a sink node. Add
`CXXForRangeStmt` makes it work.

Co-authored-by: huqizhi <836744285 at qq.com>




More information about the All-commits mailing list