[all-commits] [llvm/llvm-project] 0362a2: [clang][dataflow] Fix bug in `buildContainsExprCon...

martinboehme via All-commits all-commits at lists.llvm.org
Mon Jul 29 02:24:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0362a29905ab8d68a8eb48741840a514b66552f8
      https://github.com/llvm/llvm-project/commit/0362a29905ab8d68a8eb48741840a514b66552f8
  Author: martinboehme <mboehme at google.com>
  Date:   2024-07-29 (Mon, 29 Jul 2024)

  Changed paths:
    M clang/include/clang/Analysis/FlowSensitive/AdornedCFG.h
    M clang/lib/Analysis/FlowSensitive/AdornedCFG.cpp
    M clang/lib/Analysis/FlowSensitive/Transfer.cpp
    M clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
    M clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp

  Log Message:
  -----------
  [clang][dataflow] Fix bug in `buildContainsExprConsumedInDifferentBlock()`. (#100874)

This was missing a call to `ignoreCFGOmittedNodes()`. As a result, the
function
would erroneously conclude that a block did not contain an expression
consumed
in a different block if the expression in question was surrounded by a
`ParenExpr` in the consuming block. The patch adds a test that triggers
this
scenario (and fails without the fix).

To prevent this kind of bug in the future, the patch also adds a new
method
`blockForStmt()` to `AdornedCFG` that calls `ignoreCFGOmittedNodes()`
and is
preferred over accessing `getStmtToBlock()` directly.



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