Ninja
Public Member Functions | Public Attributes | Private Attributes | List of all members
CommandCollector Struct Reference

Collects the transitive set of edges that lead into a given set of starting nodes. More...

#include <command_collector.h>

Public Member Functions

void CollectFrom (const Node *node)
 

Public Attributes

std::vector< Edge * > in_edges
 we use a vector to preserve order from requisites to their dependents. More...
 

Private Attributes

std::unordered_set< Edge * > visited_edges_
 
std::unordered_set< const Node * > visited_nodes_
 

Detailed Description

Collects the transitive set of edges that lead into a given set of starting nodes.

Used to implement the compdb-targets tool.

When collecting inputs, the outputs of phony edges are always ignored from the result, but are followed by the dependency walk.

Usage is:

Definition at line 35 of file command_collector.h.

Member Function Documentation

◆ CollectFrom()

void CommandCollector::CollectFrom ( const Node node)
inline

Definition at line 36 of file command_collector.h.

References Node::in_edge(), in_edges, Edge::inputs_, Edge::is_phony(), visited_edges_, and visited_nodes_.

Referenced by TEST_F().

Member Data Documentation

◆ in_edges

std::vector<Edge*> CommandCollector::in_edges

we use a vector to preserve order from requisites to their dependents.

This may help LSP server performance in languages that support modules, but it also ensures that the output of -t compdb-targets foo is consistent, which is useful in regression tests.

Definition at line 62 of file command_collector.h.

Referenced by CollectFrom(), and TEST_F().

◆ visited_edges_

std::unordered_set<Edge*> CommandCollector::visited_edges_
private

Definition at line 55 of file command_collector.h.

Referenced by CollectFrom().

◆ visited_nodes_

std::unordered_set<const Node*> CommandCollector::visited_nodes_
private

Definition at line 54 of file command_collector.h.

Referenced by CollectFrom().


The documentation for this struct was generated from the following file: