This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Use `Strict` accessors in TypeErasedDataflowAnalysis.cpp.
ClosedPublic

Authored by mboehme on May 16 2023, 3:17 AM.

Details

Summary

This patch is part of the ongoing migration to strict handling of value categories (see https://discourse.llvm.org/t/70086 for details).

Depends On D150655

Diff Detail

Event Timeline

mboehme created this revision.May 16 2023, 3:17 AM
Herald added a project: Restricted Project. · View Herald Transcript
mboehme requested review of this revision.May 16 2023, 3:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 3:17 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
mboehme edited the summary of this revision. (Show Details)May 16 2023, 3:17 AM
mboehme added reviewers: sammccall, ymandel, xazax.hun.
sammccall accepted this revision.May 16 2023, 4:53 AM
This revision is now accepted and ready to land.May 16 2023, 4:53 AM
ymandel accepted this revision.May 16 2023, 5:32 AM
ymandel added inline comments.
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
310–313

Nit.

xazax.hun accepted this revision.May 16 2023, 9:49 AM
xazax.hun added inline comments.
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
303–307

I am wondering whether it is more robust to branch directly on the value category of InitStmt, although I cannot think of cases where this condition would go wrong. Feel free to ignore.

mboehme updated this revision to Diff 523032.May 17 2023, 6:26 AM

Applied suggested edit.

mboehme marked 2 inline comments as done.May 17 2023, 7:14 AM
mboehme added inline comments.
clang/lib/Analysis/FlowSensitive/TypeErasedDataflowAnalysis.cpp
303–307

I think it's actually more robust to branch on isReferenceType(), because getStorageLocationStrict contains an assertion that InitStmt is a value category -- so we're verifying that both of these conditions are met. If instead we branched on InitStmt->isGLValue(), we wouldn't be looking at Member->getType()->isReferenceType() at all, and we wouldn't be verifying that it matches our expectations (i.e. that it's a reference).

This revision was landed with ongoing or failed builds.May 21 2023, 11:51 PM
This revision was automatically updated to reflect the committed changes.
mboehme marked an inline comment as done.