summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/build.cc24
-rw-r--r--src/build.h18
-rw-r--r--src/graph.cc4
-rw-r--r--src/graph.h2
4 files changed, 24 insertions, 24 deletions
diff --git a/src/build.cc b/src/build.cc
index 931fb95..75671a6 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -96,7 +96,7 @@ void BuildStatus::PlanHasTotalEdges(int total) {
total_edges_ = total;
}
-void BuildStatus::BuildEdgeStarted(Edge* edge) {
+void BuildStatus::BuildEdgeStarted(const Edge* edge) {
assert(running_edges_.find(edge) == running_edges_.end());
int start_time = (int)(GetTimeMillis() - start_time_millis_);
running_edges_.insert(make_pair(edge, start_time));
@@ -290,7 +290,7 @@ string BuildStatus::FormatProgressStatus(
return out;
}
-void BuildStatus::PrintStatus(Edge* edge, EdgeStatus status) {
+void BuildStatus::PrintStatus(const Edge* edge, EdgeStatus status) {
if (config_.verbosity == BuildConfig::QUIET)
return;
@@ -319,11 +319,11 @@ void Plan::Reset() {
want_.clear();
}
-bool Plan::AddTarget(Node* node, string* err) {
+bool Plan::AddTarget(const Node* node, string* err) {
return AddSubTarget(node, NULL, err, NULL);
}
-bool Plan::AddSubTarget(Node* node, Node* dependent, string* err,
+bool Plan::AddSubTarget(const Node* node, const Node* dependent, string* err,
set<Edge*>* dyndep_walk) {
Edge* edge = node->in_edge();
if (!edge) { // Leaf node.
@@ -533,7 +533,7 @@ bool Plan::CleanNode(DependencyScan* scan, Node* node, string* err) {
return true;
}
-bool Plan::DyndepsLoaded(DependencyScan* scan, Node* node,
+bool Plan::DyndepsLoaded(DependencyScan* scan, const Node* node,
const DyndepFile& ddf, string* err) {
// Recompute the dirty state of all our direct and indirect dependents now
// that our dyndep information has been loaded.
@@ -601,7 +601,7 @@ bool Plan::DyndepsLoaded(DependencyScan* scan, Node* node,
return true;
}
-bool Plan::RefreshDyndepDependents(DependencyScan* scan, Node* node,
+bool Plan::RefreshDyndepDependents(DependencyScan* scan, const Node* node,
string* err) {
// Collect the transitive closure of dependents and mark their edges
// as not yet visited by RecomputeDirty.
@@ -635,7 +635,7 @@ bool Plan::RefreshDyndepDependents(DependencyScan* scan, Node* node,
return true;
}
-void Plan::UnmarkDependents(Node* node, set<Node*>* dependents) {
+void Plan::UnmarkDependents(const Node* node, set<Node*>* dependents) {
for (vector<Edge*>::const_iterator oe = node->out_edges().begin();
oe != node->out_edges().end(); ++oe) {
Edge* edge = *oe;
@@ -655,9 +655,9 @@ void Plan::UnmarkDependents(Node* node, set<Node*>* dependents) {
}
}
-void Plan::Dump() {
+void Plan::Dump() const {
printf("pending: %d\n", (int)want_.size());
- for (map<Edge*, Want>::iterator e = want_.begin(); e != want_.end(); ++e) {
+ for (map<Edge*, Want>::const_iterator e = want_.begin(); e != want_.end(); ++e) {
if (e->second != kWantNothing)
printf("want ");
e->first->Dump();
@@ -676,12 +676,12 @@ struct RealCommandRunner : public CommandRunner {
const BuildConfig& config_;
SubprocessSet subprocs_;
- map<Subprocess*, Edge*> subproc_to_edge_;
+ map<const Subprocess*, Edge*> subproc_to_edge_;
};
vector<Edge*> RealCommandRunner::GetActiveEdges() {
vector<Edge*> edges;
- for (map<Subprocess*, Edge*>::iterator e = subproc_to_edge_.begin();
+ for (map<const Subprocess*, Edge*>::iterator e = subproc_to_edge_.begin();
e != subproc_to_edge_.end(); ++e)
edges.push_back(e->second);
return edges;
@@ -720,7 +720,7 @@ bool RealCommandRunner::WaitForCommand(Result* result) {
result->status = subproc->Finish();
result->output = subproc->GetOutput();
- map<Subprocess*, Edge*>::iterator e = subproc_to_edge_.find(subproc);
+ map<const Subprocess*, Edge*>::iterator e = subproc_to_edge_.find(subproc);
result->edge = e->second;
subproc_to_edge_.erase(e);
diff --git a/src/build.h b/src/build.h
index 410d4a5..97773c4 100644
--- a/src/build.h
+++ b/src/build.h
@@ -46,7 +46,7 @@ struct Plan {
/// Add a target to our plan (including all its dependencies).
/// Returns false if we don't need to build this target; may
/// fill in |err| with an error message if there's a problem.
- bool AddTarget(Node* node, string* err);
+ bool AddTarget(const Node* node, string* err);
// Pop a ready edge off the queue of edges to build.
// Returns NULL if there's no work to do.
@@ -56,7 +56,7 @@ struct Plan {
bool more_to_do() const { return wanted_edges_ > 0 && command_edges_ > 0; }
/// Dumps the current state of the plan.
- void Dump();
+ void Dump() const;
enum EdgeResult {
kEdgeFailed,
@@ -81,12 +81,12 @@ struct Plan {
/// Update the build plan to account for modifications made to the graph
/// by information loaded from a dyndep file.
- bool DyndepsLoaded(DependencyScan* scan, Node* node,
+ bool DyndepsLoaded(DependencyScan* scan, const Node* node,
const DyndepFile& ddf, string* err);
private:
- bool RefreshDyndepDependents(DependencyScan* scan, Node* node, string* err);
- void UnmarkDependents(Node* node, set<Node*>* dependents);
- bool AddSubTarget(Node* node, Node* dependent, string* err,
+ bool RefreshDyndepDependents(DependencyScan* scan, const Node* node, string* err);
+ void UnmarkDependents(const Node* node, set<Node*>* dependents);
+ bool AddSubTarget(const Node* node, const Node* dependent, string* err,
set<Edge*>* dyndep_walk);
/// Update plan with knowledge that the given node is up to date.
@@ -240,7 +240,7 @@ struct Builder {
struct BuildStatus {
explicit BuildStatus(const BuildConfig& config);
void PlanHasTotalEdges(int total);
- void BuildEdgeStarted(Edge* edge);
+ void BuildEdgeStarted(const Edge* edge);
void BuildEdgeFinished(Edge* edge, bool success, const string& output,
int* start_time, int* end_time);
void BuildLoadDyndeps();
@@ -261,7 +261,7 @@ struct BuildStatus {
EdgeStatus status) const;
private:
- void PrintStatus(Edge* edge, EdgeStatus status);
+ void PrintStatus(const Edge* edge, EdgeStatus status);
const BuildConfig& config_;
@@ -271,7 +271,7 @@ struct BuildStatus {
int started_edges_, finished_edges_, total_edges_;
/// Map of running edge to time the edge started running.
- typedef map<Edge*, int> RunningEdgeMap;
+ typedef map<const Edge*, int> RunningEdgeMap;
RunningEdgeMap running_edges_;
/// Prints progress output.
diff --git a/src/graph.cc b/src/graph.cc
index 3214513..e24a954 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -222,8 +222,8 @@ bool DependencyScan::RecomputeOutputsDirty(Edge* edge, Node* most_recent_input,
return true;
}
-bool DependencyScan::RecomputeOutputDirty(Edge* edge,
- Node* most_recent_input,
+bool DependencyScan::RecomputeOutputDirty(const Edge* edge,
+ const Node* most_recent_input,
const string& command,
Node* output) {
if (edge->is_phony()) {
diff --git a/src/graph.h b/src/graph.h
index 19b25c4..2fa54af 100644
--- a/src/graph.h
+++ b/src/graph.h
@@ -310,7 +310,7 @@ struct DependencyScan {
/// Recompute whether a given single output should be marked dirty.
/// Returns true if so.
- bool RecomputeOutputDirty(Edge* edge, Node* most_recent_input,
+ bool RecomputeOutputDirty(const Edge* edge, const Node* most_recent_input,
const string& command, Node* output);
BuildLog* build_log_;