[PATCH] D153674: [dataflow] Disallow implicit copy of Environment, use fork() instead
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 23 17:45:38 PDT 2023
sammccall created this revision.
sammccall added reviewers: xazax.hun, ymandel.
Herald added a subscriber: martong.
Herald added a reviewer: NoQ.
Herald added a project: All.
sammccall requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Environments are heavyweight, and copies are observably different from the
original: they introduce new SAT variables, which degrade performance &
debugging. Copies should only be done deliberately, where justified.
Empirically there are several places in the framework where we perform dubious
copies, sometimes entirely accidentally. (see e.g. D153491 <https://reviews.llvm.org/D153491>). Making these
explicit makes this mistake harder.
This patch forces copies to go through fork(), the copy-constructor is private.
This requires changes to existing callsites: some are correct and call fork(),
some are incorrect and are fixed, others are difficult and I left a FIXME.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153674
Files:
clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/include/clang/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.h
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/lib/Analysis/FlowSensitive/Transfer.cpp
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153674.534138.patch
Type: text/x-patch
Size: 8311 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230624/9054408e/attachment.bin>
More information about the cfe-commits
mailing list