-
Notifications
You must be signed in to change notification settings - Fork 265
feat(cxx_indexer): experiment with variable initializer types #6080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -761,6 +764,12 @@ class GraphObserver { | |||
virtual void recordTypeEdge(const NodeId& TermNodeId, | |||
const NodeId& TypeNodeId) {} | |||
|
|||
/// \brief Records the type of a node's initializer as an edge in the graph. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which one? A node may have several initializers, e.g.
class A {
A(): mem_(AnotherOne()) {}
A(double yano): mem_(yano) {}
int mem_ = Default();
};
Each of those initializations of mem_
may be from a differently typed result, but using the semantic node has no way of distinguishing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point; while we can tell you all the types (mumble, mumble) that were used for initialization, we can't tell you anything about those use sites.
For the moment only variable declarations are in scope (no fielddecls/initializers and no assignments).
if (!ty.isNull()) { | ||
if (auto init_ty = BuildNodeIdForType(ty)) { | ||
Observer.recordInitTypeEdge(DeclNode, *init_ty); | ||
Observer.recordFlatSource(*init_ty, ty.getAsString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the "flat source" separately rather than just pointing to the type node and using its marked source?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to try both (rendering the markedsource in various places (on-demand?/denormalization) versus just using this fact).
This might need a little more refinement before it's viable to use
(e.g., we might need to track which types we've already emitted flat
code for to avoid too much redundant output).