Ninja
Public Types | Public Member Functions | Public Attributes | List of all members
Edge Struct Reference

An edge in the dependency graph; links between Nodes using Rules. More...

#include <graph.h>

Public Types

enum  VisitMark { VisitNone , VisitInStack , VisitDone }
 

Public Member Functions

bool AllInputsReady () const
 Return true if all inputs' in-edges are ready. More...
 
int64_t critical_path_weight () const
 
void Dump (const char *prefix="") const
 
 Edge ()=default
 
std::string EvaluateCommand (bool incl_rsp_file=false) const
 Expand all variables in a command and return it as a string. More...
 
std::string GetBinding (const std::string &key) const
 Returns the shell-escaped value of |key|. More...
 
bool GetBindingBool (const std::string &key) const
 
std::string GetUnescapedDepfile () const
 Like GetBinding("depfile"), but without shell escaping. More...
 
std::string GetUnescapedDyndep () const
 Like GetBinding("dyndep"), but without shell escaping. More...
 
std::string GetUnescapedRspfile () const
 Like GetBinding("rspfile"), but without shell escaping. More...
 
bool is_implicit (size_t index)
 
bool is_implicit_out (size_t index) const
 
bool is_order_only (size_t index)
 
bool is_phony () const
 
bool maybe_phonycycle_diagnostic () const
 
bool outputs_ready () const
 
Poolpool () const
 
const Rulerule () const
 
void set_critical_path_weight (int64_t critical_path_weight)
 
bool use_console () const
 
int weight () const
 

Public Attributes

TimeStamp command_start_time_ = 0
 
int64_t critical_path_weight_ = -1
 
bool deps_loaded_ = false
 
bool deps_missing_ = false
 
Nodedyndep_ = nullptr
 
BindingEnvenv_ = nullptr
 
bool generated_by_dep_loader_ = false
 
size_t id_ = 0
 
int implicit_deps_ = 0
 
int implicit_outs_ = 0
 
std::vector< Node * > inputs_
 
Jobserver::Slot job_slot_
 A Jobserver slot instance. Invalid by default. More...
 
VisitMark mark_ = VisitNone
 
int order_only_deps_ = 0
 
std::vector< Node * > outputs_
 
bool outputs_ready_ = false
 
Poolpool_ = nullptr
 
int64_t prev_elapsed_time_millis = -1
 
const Rulerule_ = nullptr
 
std::vector< Node * > validations_
 

Detailed Description

An edge in the dependency graph; links between Nodes using Rules.

Definition at line 175 of file graph.h.

Member Enumeration Documentation

◆ VisitMark

Enumerator
VisitNone 
VisitInStack 
VisitDone 

Definition at line 176 of file graph.h.

Constructor & Destructor Documentation

◆ Edge()

Edge::Edge ( )
default

Member Function Documentation

◆ AllInputsReady()

bool Edge::AllInputsReady ( ) const

Return true if all inputs' in-edges are ready.

Definition at line 381 of file graph.cc.

Referenced by Plan::EdgeMaybeReady(), and Plan::ScheduleInitialEdges().

◆ critical_path_weight()

int64_t Edge::critical_path_weight ( ) const
inline

◆ Dump()

void Edge::Dump ( const char *  prefix = "") const

Definition at line 535 of file graph.cc.

◆ EvaluateCommand()

std::string Edge::EvaluateCommand ( bool  incl_rsp_file = false) const

Expand all variables in a command and return it as a string.

If incl_rsp_file is enabled, the string will also contain the full contents of a response file (if applicable)

Definition at line 501 of file graph.cc.

Referenced by StatusPrinter::BuildEdgeFinished(), DependencyScan::RecomputeOutputsDirty(), BuildLog::RecordCommand(), FakeCommandRunner::StartCommand(), RealCommandRunner::StartCommand(), Builder::StartEdge(), and TEST_F().

◆ GetBinding()

std::string Edge::GetBinding ( const std::string &  key) const

◆ GetBindingBool()

bool Edge::GetBindingBool ( const std::string &  key) const

◆ GetUnescapedDepfile()

string Edge::GetUnescapedDepfile ( ) const

Like GetBinding("depfile"), but without shell escaping.

Definition at line 520 of file graph.cc.

References EdgeEnv::kDoNotEscape, and EdgeEnv::LookupVariable().

Referenced by Builder::ExtractDeps(), ImplicitDepLoader::LoadDeps(), Cleaner::RemoveEdgeFiles(), FakeCommandRunner::StartCommand(), and Builder::StartEdge().

◆ GetUnescapedDyndep()

string Edge::GetUnescapedDyndep ( ) const

Like GetBinding("dyndep"), but without shell escaping.

Definition at line 525 of file graph.cc.

References EdgeEnv::kDoNotEscape, and EdgeEnv::LookupVariable().

Referenced by ManifestParser::ParseEdge().

◆ GetUnescapedRspfile()

std::string Edge::GetUnescapedRspfile ( ) const

Like GetBinding("rspfile"), but without shell escaping.

Definition at line 530 of file graph.cc.

References EdgeEnv::kDoNotEscape, and EdgeEnv::LookupVariable().

Referenced by Builder::FinishCommand(), Cleaner::RemoveEdgeFiles(), and Builder::StartEdge().

◆ is_implicit()

bool Edge::is_implicit ( size_t  index)
inline

Definition at line 245 of file graph.h.

References implicit_deps_, inputs_, is_order_only(), and order_only_deps_.

Referenced by TEST_F().

◆ is_implicit_out()

bool Edge::is_implicit_out ( size_t  index) const
inline

Definition at line 259 of file graph.h.

References implicit_outs_, and outputs_.

Referenced by TEST_F().

◆ is_order_only()

bool Edge::is_order_only ( size_t  index)
inline

Definition at line 249 of file graph.h.

References inputs_, and order_only_deps_.

Referenced by GraphViz::AddTarget(), is_implicit(), DependencyScan::RecomputeNodeDirty(), and TEST_F().

◆ is_phony()

bool Edge::is_phony ( ) const

◆ maybe_phonycycle_diagnostic()

bool Edge::maybe_phonycycle_diagnostic ( ) const

Definition at line 571 of file graph.cc.

Referenced by ManifestParser::ParseEdge(), and DependencyScan::VerifyDAG().

◆ outputs_ready()

bool Edge::outputs_ready ( ) const
inline

◆ pool()

Pool* Edge::pool ( ) const
inline

Definition at line 231 of file graph.h.

References pool_.

Referenced by Plan::EdgeFinished(), Plan::ScheduleInitialEdges(), and Plan::ScheduleWork().

◆ rule()

const Rule& Edge::rule ( ) const
inline

Definition at line 230 of file graph.h.

References rule_.

Referenced by FakeCommandRunner::StartCommand(), and FakeCommandRunner::WaitForCommand().

◆ set_critical_path_weight()

void Edge::set_critical_path_weight ( int64_t  critical_path_weight)
inline

Definition at line 210 of file graph.h.

References critical_path_weight(), and critical_path_weight_.

Referenced by Plan::ComputeCriticalPath(), and TEST_F().

◆ use_console()

bool Edge::use_console ( ) const

◆ weight()

int Edge::weight ( ) const
inline

Member Data Documentation

◆ command_start_time_

TimeStamp Edge::command_start_time_ = 0

Definition at line 228 of file graph.h.

Referenced by Builder::FinishCommand(), and Builder::StartEdge().

◆ critical_path_weight_

int64_t Edge::critical_path_weight_ = -1

Definition at line 223 of file graph.h.

Referenced by critical_path_weight(), and set_critical_path_weight().

◆ deps_loaded_

bool Edge::deps_loaded_ = false

Definition at line 225 of file graph.h.

Referenced by DependencyScan::RecomputeNodeDirty().

◆ deps_missing_

bool Edge::deps_missing_ = false

Definition at line 226 of file graph.h.

Referenced by DependencyScan::RecomputeNodeDirty().

◆ dyndep_

Node* Edge::dyndep_ = nullptr

◆ env_

BindingEnv* Edge::env_ = nullptr

Definition at line 220 of file graph.h.

Referenced by State::AddEdge(), ManifestParser::ParseEdge(), and DyndepLoader::UpdateEdge().

◆ generated_by_dep_loader_

bool Edge::generated_by_dep_loader_ = false

Definition at line 227 of file graph.h.

◆ id_

size_t Edge::id_ = 0

Definition at line 222 of file graph.h.

Referenced by State::AddEdge(), EdgeCmp::operator()(), and EdgePriorityLess::operator()().

◆ implicit_deps_

int Edge::implicit_deps_ = 0

◆ implicit_outs_

int Edge::implicit_outs_ = 0

◆ inputs_

std::vector<Node*> Edge::inputs_

◆ job_slot_

Jobserver::Slot Edge::job_slot_

A Jobserver slot instance. Invalid by default.

Definition at line 268 of file graph.h.

Referenced by Plan::EdgeFinished(), and Plan::FindWork().

◆ mark_

VisitMark Edge::mark_ = VisitNone

◆ order_only_deps_

int Edge::order_only_deps_ = 0

◆ outputs_

std::vector<Node*> Edge::outputs_

◆ outputs_ready_

bool Edge::outputs_ready_ = false

Definition at line 224 of file graph.h.

Referenced by Plan::EdgeFinished(), outputs_ready(), and DependencyScan::RecomputeNodeDirty().

◆ pool_

Pool* Edge::pool_ = nullptr

Definition at line 215 of file graph.h.

Referenced by State::AddEdge(), ManifestParser::ParseEdge(), and pool().

◆ prev_elapsed_time_millis

int64_t Edge::prev_elapsed_time_millis = -1

◆ rule_

const Rule* Edge::rule_ = nullptr

Definition at line 214 of file graph.h.

Referenced by State::AddEdge(), GraphViz::AddTarget(), and rule().

◆ validations_

std::vector<Node*> Edge::validations_

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