diff options
author | Martin Braenne <mboehme@google.com> | 2023-06-05 11:30:39 +0000 |
---|---|---|
committer | Martin Braenne <mboehme@google.com> | 2023-06-05 12:52:51 +0000 |
commit | af22be39038a9c464474410c3a8b3cb428d8b25a (patch) | |
tree | 09bdb7908d07f5c63892f31b9bd66561421109cb /clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp | |
parent | d2d32f39217f4cf15926ec6ae23e28447c3f5052 (diff) | |
download | llvm-af22be39038a9c464474410c3a8b3cb428d8b25a.zip llvm-af22be39038a9c464474410c3a8b3cb428d8b25a.tar.gz llvm-af22be39038a9c464474410c3a8b3cb428d8b25a.tar.bz2 |
[clang][dataflow] Use a `PointerValue` for `value` property in optional checker.
The `ReferenceValue` class will be eliminated as part of the ongoing migration
to strict handling of value categories (see https://discourse.llvm.org/t/70086
for details).
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D152144
Diffstat (limited to 'clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp')
-rw-r--r-- | clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp index 7d30473..1095fd4 100644 --- a/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp +++ b/clang/lib/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.cpp @@ -307,12 +307,12 @@ StorageLocation *maybeInitializeOptionalValueMember(QualType Q, Environment &Env) { // The "value" property represents a synthetic field. As such, it needs // `StorageLocation`, like normal fields (and other variables). So, we model - // it with a `ReferenceValue`, since that includes a storage location. Once + // it with a `PointerValue`, since that includes a storage location. Once // the property is set, it will be shared by all environments that access the // `Value` representing the optional (here, `OptionalVal`). if (auto *ValueProp = OptionalVal.getProperty("value")) { - auto *ValueRef = clang::cast<ReferenceValue>(ValueProp); - auto &ValueLoc = ValueRef->getReferentLoc(); + auto *ValuePtr = clang::cast<PointerValue>(ValueProp); + auto &ValueLoc = ValuePtr->getPointeeLoc(); if (Env.getValue(ValueLoc) == nullptr) { // The property was previously set, but the value has been lost. This can // happen, for example, because of an environment merge (where the two @@ -339,8 +339,8 @@ StorageLocation *maybeInitializeOptionalValueMember(QualType Q, return nullptr; auto &ValueLoc = Env.createStorageLocation(Ty); Env.setValue(ValueLoc, *ValueVal); - auto &ValueRef = Env.create<ReferenceValue>(ValueLoc); - OptionalVal.setProperty("value", ValueRef); + auto &ValuePtr = Env.create<PointerValue>(ValueLoc); + OptionalVal.setProperty("value", ValuePtr); return &ValueLoc; } |