This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Remove IndirectionValue class, moving PointeeLoc field into PointerValue and ReferenceValue
ClosedPublic

Authored by wyt on Jun 8 2022, 8:26 AM.

Details

Summary

This patch precedes a future patch to make PointeeLoc for PointerValue possibly empty (for nullptr), by using a pointer instead of a reference type.
ReferenceValue should maintain a non-empty PointeeLoc reference.

Diff Detail

Event Timeline

wyt created this revision.Jun 8 2022, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 8:26 AM
wyt requested review of this revision.Jun 8 2022, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 8:26 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
wyt retitled this revision from [clang][dataflow] Move PointeeLoc field from IndirectionValue into PointerValue and ReferenceValue classes to [clang][dataflow] Remove IndirectionValue class, moving PointeeLoc field into PointerValue and ReferenceValue.Jun 8 2022, 8:39 AM
wyt edited the summary of this revision. (Show Details)
gribozavr2 added inline comments.Jun 8 2022, 10:47 AM
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
53

WDYT about "areEquivalentIndirectionValues"?

63

This assert was lost in the new implementation.

wyt updated this revision to Diff 435271.Jun 8 2022, 11:35 AM
wyt marked 2 inline comments as done.

Rename function as suggested

clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
63

The assertion was to ensure that the values were either both Reference or both Pointer, as an IndirectionValue could be either.
Since we've removed IndirectionVal and have separate casts for ReferenceVal/PointerVal, the assertion is not neccessary.

gribozavr2 accepted this revision.Jun 8 2022, 4:14 PM
gribozavr2 added inline comments.
clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp
63

Ah I see, the cast now plays the role of the assert.

This revision is now accepted and ready to land.Jun 8 2022, 4:14 PM