[PATCH] D153006: [clang][dataflow] Perform deep copies in copy and move operations.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 15 03:18:28 PDT 2023
mboehme created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a reviewer: NoQ.
Herald added a project: All.
mboehme requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
This serves two purposes:
- Because, today, we only copy the `StructValue`, modifying the destination of the copy also modifies the source. This is demonstrated by the new checks added to `CopyConstructor` and `MoveConstructor`, which fail without the deep copy.
- It lays the groundwork for eliminating the redundancy between `AggregateStorageLocation` and `StructValue`, which will happen as part of the ongoing migration to strict handling of value categories (seeo https://discourse.llvm.org/t/70086 for details). This will involve turning `StructValue` into essentially just a wrapper for `AggregateStorageLocation`; under this scheme, the current "shallow" copy (copying a `StructValue` from one `AggregateStorageLocation` to another) will no longer be possible.
Because we now perform deep copies, tests need to perform a deep equality
comparison instead of just comparing for equal identity of the `StructValue`s.
The new function `recordsEqual()` provides such a deep equality comparison.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153006
Files:
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/include/clang/Analysis/FlowSensitive/RecordOps.h
clang/include/clang/Analysis/FlowSensitive/StorageLocation.h
clang/include/clang/Analysis/FlowSensitive/Value.h
clang/lib/Analysis/FlowSensitive/CMakeLists.txt
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/lib/Analysis/FlowSensitive/RecordOps.cpp
clang/lib/Analysis/FlowSensitive/Transfer.cpp
clang/unittests/Analysis/FlowSensitive/CMakeLists.txt
clang/unittests/Analysis/FlowSensitive/RecordOpsTest.cpp
clang/unittests/Analysis/FlowSensitive/TestingSupport.h
clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153006.531677.patch
Type: text/x-patch
Size: 40585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230615/343e054e/attachment-0001.bin>
More information about the cfe-commits
mailing list