[PATCH] D155921: [clang][dataflow] Reverse course on `getValue()` deprecation.

Martin Böhme via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 21 00:53:28 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.

In the value categories RFC <https://discourse.llvm.org/t/70086>, I proposed
that the end state of the migration should be that `getValue()` should only be
legal to call on prvalues.

As a stepping stone, to allow migrating off existing calls to `getValue()`, I
proposed introducing `getValueStrict()`, which would already have the new
semantics.

However, I've now reconsidered this. Any expression, whether prvalue or glvalue,
has a value, so really there isn't any reason to forbid calling `getValue()`
on glvalues. I'm therefore removing the deprecation from `getValue()` and
transitioning existing `getValueStrict()` calls back to `getValue()`.

The other "strict" accessors are a different case. `setValueStrict()` should
only be called on prvalues because glvalues need to have a storage location
associated with them; it doesn't make sense to only set a value for them. And,
of course, `getStorageLocationStrict()` and `setStorageLocationStrict()` should
obviously only be called on glvalues because prvalues don't have storage
locations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155921

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
  clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
  clang/unittests/Analysis/FlowSensitive/SignAnalysisTest.cpp
  clang/unittests/Analysis/FlowSensitive/TransferTest.cpp
  clang/unittests/Analysis/FlowSensitive/TypeErasedDataflowAnalysisTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155921.542789.patch
Type: text/x-patch
Size: 14739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230721/3bb70422/attachment.bin>


More information about the cfe-commits mailing list