[PATCH] D125821: [clang][dataflow] Fix double visitation of nested logical operators

Eric Li via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 11:25:51 PDT 2022


li.zhe.hua created this revision.
li.zhe.hua added a reviewer: ymandel.
Herald added subscribers: tschuett, steakhal.
Herald added a project: All.
li.zhe.hua requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Sub-expressions that are logical operators are not spelled out
separately in basic blocks, so we need to manually visit them when we
encounter them. We do this in both the `TerminatorVisitor`
(conditionally) and the `TransferVisitor` (unconditionally), which can
cause cause an expression to be visited twice when the binary
operators are nested 2+ times.

This changes the visit in `TransferVisitor` to check if it has been
evaluated before trying to visit the sub-expression.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125821

Files:
  clang/lib/Analysis/FlowSensitive/Transfer.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125821.430136.patch
Type: text/x-patch
Size: 4259 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220517/56a602f6/attachment-0001.bin>


More information about the cfe-commits mailing list