This is an archive of the discontinued LLVM Phabricator instance.

[clang][dataflow] Add transfer functions for initializers
ClosedPublic

Authored by sgatev on Jan 12 2022, 8:32 AM.

Details

Summary

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Diff Detail

Event Timeline

sgatev created this revision.Jan 12 2022, 8:32 AM
sgatev requested review of this revision.Jan 12 2022, 8:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 12 2022, 8:32 AM
ymandel accepted this revision.Jan 12 2022, 11:09 AM
ymandel added inline comments.
clang/lib/Analysis/FlowSensitive/Transfer.cpp
171

why None? Is the idea that if the expression generates a reference, we want to get the pointer value, not the pointee?
So, in the example below, the value set for field y will (correctly) be the same pointer stored in field x?

struct A {
  int &x;
  int &y = x;
};
This revision is now accepted and ready to land.Jan 12 2022, 11:09 AM
xazax.hun accepted this revision.Jan 12 2022, 12:58 PM
sgatev marked an inline comment as done.Jan 12 2022, 1:34 PM
sgatev added inline comments.
clang/lib/Analysis/FlowSensitive/Transfer.cpp
171

Right, y gets assigned the same ReferenceValue as x in this case.

This revision was automatically updated to reflect the committed changes.
sgatev marked an inline comment as done.