[PATCH] D158977: [clang][dataflow] Don't associate prvalue expressions with storage locations.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 28 04:51:05 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.
Instead, map prvalue expressions directly to values in a newly introduced map
`Environment::ExprToVal`.
This change introduces an additional member variable in `Environment` but is
an overall win:
- It is more conceptually correctly, since prvalues don't have storage locations.
- It eliminates complexity from `Environment::setValue(const Expr &E, Value &Val)`.
- It reduces the amount of data stored in `Environment`: A prvalue now has a single entry in `ExprToVal` instead of one in `ExprToLoc` and one in `LocToVal`.
- Not allocating `StorageLocation`s for prvalues additionally reduces memory usage.
This patch is the last step in the migration to strict handling of value
categories (see https://discourse.llvm.org/t/70086 for details). The changes
here are almost entirely internal to `Environment`.
The only externally observable change is that when associating a `RecordValue`
with the location returned by `Environment::getResultObjectLocation()` for a
given expression, callers additionally need to associate the `RecordValue` with
the expression themselves.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158977
Files:
clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
clang/lib/Analysis/FlowSensitive/Transfer.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158977.553892.patch
Type: text/x-patch
Size: 13618 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230828/4e8ff904/attachment.bin>
More information about the cfe-commits
mailing list