[PATCH] D156672: [clang][dataflow] Use `Strict` accessors where we weren't using them yet.
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 31 05:24:32 PDT 2023
ymandel accepted this revision.
ymandel added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp:542
+ State.Env.getStorageLocationStrict(*E));
+ if (!Loc) {
+ Loc =
----------------
`loc == nullptr`
================
Comment at: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp:545
+ &cast<AggregateStorageLocation>(State.Env.createStorageLocation(*E));
+ State.Env.setStorageLocationStrict(*E, *Loc);
+ }
----------------
Should this line instead be outside of this `if`? So that the flow is
```
Loc = get
if (!Loc) Loc = create
set(Loc)
```
================
Comment at: clang/lib/Analysis/FlowSensitive/Transfer.cpp:473-474
if (S->isElidable()) {
- Env.setStorageLocation(*S, *ArgLoc);
- } else if (auto *ArgVal = cast_or_null<StructValue>(Env.getValue(*Arg))) {
+ if (Value *Val = Env.getValue(*ArgLoc))
+ Env.setValueStrict(*S, *Val);
+ } else {
----------------
What happens otherwise? I gather that `S` just isn't associated with anything?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156672/new/
https://reviews.llvm.org/D156672
More information about the cfe-commits
mailing list