This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Fix bug in handling of reference-typed fields.
ClosedPublic

Authored by ymandel on Jan 24 2023, 6:54 AM.

Details

Summary

This patch fixes a subtle bug in how we create lvalues to reference-typed
fields. In the rare case that the field is umodeled because of the depth limit
on field modeling, the lvalue created can be malformed. This patch prevents that
and adds some related assertions to other code dealing with lvalues for
references.

Diff Detail

Event Timeline

ymandel created this revision.Jan 24 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald Transcript
ymandel requested review of this revision.Jan 24 2023, 6:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2023, 6:54 AM
sgatev accepted this revision.Jan 24 2023, 7:47 AM
sgatev added inline comments.
clang/lib/Analysis/FlowSensitive/Transfer.cpp
209

Can we use isa_and_nonnull(Env.getValue(Loc)) instead?

This revision is now accepted and ready to land.Jan 24 2023, 7:47 AM
ymandel updated this revision to Diff 491806.Jan 24 2023, 8:01 AM

use isa_and_nonnull

ymandel marked an inline comment as done.Jan 24 2023, 8:02 AM
ymandel added inline comments.
clang/lib/Analysis/FlowSensitive/Transfer.cpp
209

Yes, much better. Thanks!

This revision was landed with ongoing or failed builds.Jan 24 2023, 8:11 AM
This revision was automatically updated to reflect the committed changes.
ymandel marked an inline comment as done.