[PATCH] D154935: [clang][dataflow] Introduce `getFieldValue()` test helpers.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 02:26:34 PDT 2023


mboehme created this revision.
Herald added subscribers: martong, xazax.hun.
Herald added a project: All.
mboehme requested review of this revision.
Herald added subscribers: cfe-commits, wangpc.
Herald added a project: clang.

These insulate tests against changes to the `getChild()` functions of
`AggregateStorageLocation` and `StructValue` that will happen as part of the
migration to strict handling of value categories (see
https://discourse.llvm.org/t/70086 for details):

- `AggregateStorageLocation::getChild()` will soon return a `StorageLocation *` instead of a `StorageLocation &`. When this happens, `getFieldValue()` will be changed to return null if `AggregateStorageLocation::getChild()` returns null; test code will not need to change as it should already be checking whether the return value of `getFieldValue()` is null.

- `StructValue::getChild()` will soon return a `StorageLocation *` instead of a `Value *`. When this happens, `getFieldValue()` will be changed to look up the `Value *` in the `Environment`. Again, test code will not need to change.

The test helpers will continue to serve a useful purpose once the API changes
are complete, so the intent is to leave them in place.

This patch changes DataflowEnvironmentTest.cpp and RecordOpsTest.cpp to use the
test helpers. TransferTest.cpp will be changed in an upcoming patch to help keep
patch sizes manageable for review.

Depends On D154934 <https://reviews.llvm.org/D154934>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154935

Files:
  clang/unittests/Analysis/FlowSensitive/DataflowEnvironmentTest.cpp
  clang/unittests/Analysis/FlowSensitive/RecordOpsTest.cpp
  clang/unittests/Analysis/FlowSensitive/TestingSupport.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154935.538977.patch
Type: text/x-patch
Size: 5507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230711/fe987e39/attachment-0001.bin>


More information about the cfe-commits mailing list