[PATCH] D155202: [clang][dataflow] Simplify implementation of `transferStdForwardCall()` in optional check.
Martin Böhme via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 13 07:23:56 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.
The argument and return value of `std::forward` is always a reference, so we
can simply forward the storage location.
Depends On D155075 <https://reviews.llvm.org/D155075>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155202
Files:
clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
Index: clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
===================================================================
--- clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
+++ clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp
@@ -680,25 +680,8 @@
LatticeTransferState &State) {
assert(E->getNumArgs() == 1);
- StorageLocation *LocRet = State.Env.getStorageLocation(*E, SkipPast::None);
- if (LocRet != nullptr)
- return;
-
- StorageLocation *LocArg =
- State.Env.getStorageLocation(*E->getArg(0), SkipPast::Reference);
-
- if (LocArg == nullptr)
- return;
-
- Value *ValArg = State.Env.getValue(*LocArg);
- if (ValArg == nullptr)
- ValArg = &createOptionalValue(State.Env.makeAtomicBoolValue(), State.Env);
-
- // Create a new storage location
- LocRet = &State.Env.createStorageLocation(*E);
- State.Env.setStorageLocation(*E, *LocRet);
-
- State.Env.setValue(*LocRet, *ValArg);
+ if (auto *Loc = State.Env.getStorageLocationStrict(*E->getArg(0)))
+ State.Env.setStorageLocationStrict(*E, *Loc);
}
BoolValue &evaluateEquality(Environment &Env, BoolValue &EqVal, BoolValue &LHS,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155202.540023.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230713/f452a752/attachment.bin>
More information about the cfe-commits
mailing list