23
23
#include " state.h"
24
24
#include " util.h"
25
25
26
- bool FileStat ::Stat (DiskInterface* disk_interface) {
26
+ bool Node ::Stat (DiskInterface* disk_interface) {
27
27
mtime_ = disk_interface->Stat (path_);
28
28
return mtime_ > 0 ;
29
29
}
@@ -41,13 +41,13 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
41
41
// Visit all inputs; we're dirty if any of the inputs are dirty.
42
42
time_t most_recent_input = 1 ;
43
43
for (vector<Node*>::iterator i = inputs_.begin (); i != inputs_.end (); ++i) {
44
- if ((*i)->file_ -> StatIfNecessary (disk_interface)) {
44
+ if ((*i)->StatIfNecessary (disk_interface)) {
45
45
if (Edge* edge = (*i)->in_edge_ ) {
46
46
if (!edge->RecomputeDirty (state, disk_interface, err))
47
47
return false ;
48
48
} else {
49
49
// This input has no in-edge; it is dirty if it is missing.
50
- (*i)->dirty_ = !(*i)->file_ -> exists ();
50
+ (*i)->dirty_ = !(*i)->exists ();
51
51
}
52
52
}
53
53
@@ -63,8 +63,8 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
63
63
if ((*i)->dirty_ ) {
64
64
dirty = true ;
65
65
} else {
66
- if ((*i)->file_ -> mtime_ > most_recent_input)
67
- most_recent_input = (*i)->file_ -> mtime_ ;
66
+ if ((*i)->mtime () > most_recent_input)
67
+ most_recent_input = (*i)->mtime () ;
68
68
}
69
69
}
70
70
}
@@ -77,7 +77,7 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
77
77
78
78
for (vector<Node*>::iterator i = outputs_.begin ();
79
79
i != outputs_.end (); ++i) {
80
- (*i)->file_ -> StatIfNecessary (disk_interface);
80
+ (*i)->StatIfNecessary (disk_interface);
81
81
if (RecomputeOutputDirty (build_log, most_recent_input, command, *i)) {
82
82
dirty = true ;
83
83
break ;
@@ -88,7 +88,7 @@ bool Edge::RecomputeDirty(State* state, DiskInterface* disk_interface,
88
88
// Finally, visit each output to mark off that we've visited it, and update
89
89
// their dirty state if necessary.
90
90
for (vector<Node*>::iterator i = outputs_.begin (); i != outputs_.end (); ++i) {
91
- (*i)->file_ -> StatIfNecessary (disk_interface);
91
+ (*i)->StatIfNecessary (disk_interface);
92
92
if (dirty)
93
93
(*i)->dirty_ = true ;
94
94
}
@@ -107,23 +107,23 @@ bool Edge::RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input,
107
107
if (is_phony ()) {
108
108
// Phony edges don't write any output.
109
109
// Outputs are only dirty if there are no inputs and we're missing the output.
110
- return inputs_.empty () && !output->file_ -> exists ();
110
+ return inputs_.empty () && !output->exists ();
111
111
}
112
112
113
113
BuildLog::LogEntry* entry = 0 ;
114
114
115
115
// Dirty if we're missing the output.
116
- if (!output->file_ -> exists ())
116
+ if (!output->exists ())
117
117
return true ;
118
118
119
119
// Dirty if the output is older than the input.
120
- if (output->file_ -> mtime_ < most_recent_input) {
120
+ if (output->mtime () < most_recent_input) {
121
121
// If this is a restat rule, we may have cleaned the output with a restat
122
122
// rule in a previous run and stored the most recent input mtime in the
123
123
// build log. Use that mtime instead, so that the file will only be
124
124
// considered dirty if an input was modified since the previous run.
125
125
if (rule_->restat_ && build_log &&
126
- (entry = build_log->LookupByOutput (output->file_ -> path_ ))) {
126
+ (entry = build_log->LookupByOutput (output->path () ))) {
127
127
if (entry->restat_mtime < most_recent_input)
128
128
return true ;
129
129
} else {
@@ -135,7 +135,7 @@ bool Edge::RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input,
135
135
// But if this is a generator rule, the command changing does not make us
136
136
// dirty.
137
137
if (!rule_->generator_ && build_log &&
138
- (entry || (entry = build_log->LookupByOutput (output->file_ -> path_ )))) {
138
+ (entry || (entry = build_log->LookupByOutput (output->path () )))) {
139
139
if (command != entry->command )
140
140
return true ;
141
141
}
@@ -164,14 +164,14 @@ struct EdgeEnv : public Env {
164
164
i != edge_->inputs_ .end () && explicit_deps; ++i, --explicit_deps) {
165
165
if (!result.empty ())
166
166
result.push_back (' ' );
167
- result.append ((*i)->file_ -> path_ );
167
+ result.append ((*i)->path () );
168
168
}
169
169
} else if (var == " out" ) {
170
170
for (vector<Node*>::iterator i = edge_->outputs_ .begin ();
171
171
i != edge_->outputs_ .end (); ++i) {
172
172
if (!result.empty ())
173
173
result.push_back (' ' );
174
- result.append ((*i)->file_ -> path_ );
174
+ result.append ((*i)->path () );
175
175
}
176
176
} else if (edge_->env_ ) {
177
177
return edge_->env_ ->LookupVariable (var);
@@ -213,10 +213,10 @@ bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface,
213
213
}
214
214
215
215
// Check that this depfile matches our output.
216
- StringPiece opath = StringPiece (outputs_[0 ]->file_ -> path_ );
216
+ StringPiece opath = StringPiece (outputs_[0 ]->path () );
217
217
if (opath != makefile.out_ ) {
218
218
*err = " expected depfile '" + path + " ' to mention '" +
219
- outputs_[0 ]->file_ -> path_ + " ', got '" + makefile.out_ .AsString () + " '" ;
219
+ outputs_[0 ]->path () + " ', got '" + makefile.out_ .AsString () + " '" ;
220
220
return false ;
221
221
}
222
222
@@ -260,11 +260,11 @@ bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface,
260
260
void Edge::Dump () {
261
261
printf (" [ " );
262
262
for (vector<Node*>::iterator i = inputs_.begin (); i != inputs_.end (); ++i) {
263
- printf (" %s " , (*i)->file_ -> path_ .c_str ());
263
+ printf (" %s " , (*i)->path () .c_str ());
264
264
}
265
265
printf (" --%s-> " , rule_->name_ .c_str ());
266
266
for (vector<Node*>::iterator i = outputs_.begin (); i != outputs_.end (); ++i) {
267
- printf (" %s " , (*i)->file_ -> path_ .c_str ());
267
+ printf (" %s " , (*i)->path () .c_str ());
268
268
}
269
269
printf (" ]\n " );
270
270
}
0 commit comments