diff options
Diffstat (limited to 'src/build.h')
-rw-r--r-- | src/build.h | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/src/build.h b/src/build.h index 97773c4..2798693 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(const Node* node, string* err); + bool AddTarget(const Node* node, std::string* err); // Pop a ready edge off the queue of edges to build. // Returns NULL if there's no work to do. @@ -67,11 +67,11 @@ struct Plan { /// If any of the edge's outputs are dyndep bindings of their dependents, /// this loads dynamic dependencies from the nodes' paths. /// Returns 'false' if loading dyndep info fails and 'true' otherwise. - bool EdgeFinished(Edge* edge, EdgeResult result, string* err); + bool EdgeFinished(Edge* edge, EdgeResult result, std::string* err); /// Clean the given node during the build. /// Return false on error. - bool CleanNode(DependencyScan* scan, Node* node, string* err); + bool CleanNode(DependencyScan* scan, Node* node, std::string* err); /// Number of edges with commands to run. int command_edge_count() const { return command_edges_; } @@ -82,18 +82,18 @@ 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, const Node* node, - const DyndepFile& ddf, string* err); + const DyndepFile& ddf, std::string* err); private: - 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); + bool RefreshDyndepDependents(DependencyScan* scan, const Node* node, std::string* err); + void UnmarkDependents(const Node* node, std::set<Node*>* dependents); + bool AddSubTarget(const Node* node, const Node* dependent, std::string* err, + std::set<Edge*>* dyndep_walk); /// Update plan with knowledge that the given node is up to date. /// If the node is a dyndep binding on any of its dependents, this /// loads dynamic dependencies from the node's path. /// Returns 'false' if loading dyndep info fails and 'true' otherwise. - bool NodeFinished(Node* node, string* err); + bool NodeFinished(Node* node, std::string* err); /// Enumerate possible steps we want for an edge. enum Want @@ -109,20 +109,20 @@ private: }; void EdgeWanted(const Edge* edge); - bool EdgeMaybeReady(map<Edge*, Want>::iterator want_e, string* err); + bool EdgeMaybeReady(std::map<Edge*, Want>::iterator want_e, std::string* err); /// Submits a ready edge as a candidate for execution. /// The edge may be delayed from running, for example if it's a member of a /// currently-full pool. - void ScheduleWork(map<Edge*, Want>::iterator want_e); + void ScheduleWork(std::map<Edge*, Want>::iterator want_e); /// Keep track of which edges we want to build in this plan. If this map does /// not contain an entry for an edge, we do not want to build the entry or its /// dependents. If it does contain an entry, the enumeration indicates what /// we want for the edge. - map<Edge*, Want> want_; + std::map<Edge*, Want> want_; - set<Edge*> ready_; + std::set<Edge*> ready_; Builder* builder_; @@ -146,13 +146,13 @@ struct CommandRunner { Result() : edge(NULL) {} Edge* edge; ExitStatus status; - string output; + std::string output; bool success() const { return status == ExitSuccess; } }; /// Wait for a command to complete, or return false if interrupted. virtual bool WaitForCommand(Result* result) = 0; - virtual vector<Edge*> GetActiveEdges() { return vector<Edge*>(); } + virtual std::vector<Edge*> GetActiveEdges() { return std::vector<Edge*>(); } virtual void Abort() {} }; @@ -186,24 +186,24 @@ struct Builder { /// Clean up after interrupted commands by deleting output files. void Cleanup(); - Node* AddTarget(const string& name, string* err); + Node* AddTarget(const std::string& name, std::string* err); /// Add a target to the build, scanning dependencies. /// @return false on error. - bool AddTarget(Node* target, string* err); + bool AddTarget(Node* target, std::string* err); /// Returns true if the build targets are already up to date. bool AlreadyUpToDate() const; /// Run the build. Returns false on error. /// It is an error to call this function when AlreadyUpToDate() is true. - bool Build(string* err); + bool Build(std::string* err); - bool StartEdge(Edge* edge, string* err); + bool StartEdge(Edge* edge, std::string* err); /// Update status ninja logs following a command termination. /// @return false if the build can not proceed further due to a fatal error. - bool FinishCommand(CommandRunner::Result* result, string* err); + bool FinishCommand(CommandRunner::Result* result, std::string* err); /// Used for tests. void SetBuildLog(BuildLog* log) { @@ -211,22 +211,22 @@ struct Builder { } /// Load the dyndep information provided by the given node. - bool LoadDyndeps(Node* node, string* err); + bool LoadDyndeps(Node* node, std::string* err); State* state_; const BuildConfig& config_; Plan plan_; #if __cplusplus < 201703L - auto_ptr<CommandRunner> command_runner_; + std::auto_ptr<CommandRunner> command_runner_; #else - unique_ptr<CommandRunner> command_runner_; // auto_ptr was removed in C++17. + std::unique_ptr<CommandRunner> command_runner_; // auto_ptr was removed in C++17. #endif BuildStatus* status_; private: - bool ExtractDeps(CommandRunner::Result* result, const string& deps_type, - const string& deps_prefix, vector<Node*>* deps_nodes, - string* err); + bool ExtractDeps(CommandRunner::Result* result, const std::string& deps_type, + const std::string& deps_prefix, + std::vector<Node*>* deps_nodes, std::string* err); DiskInterface* disk_interface_; DependencyScan scan_; @@ -241,7 +241,7 @@ struct BuildStatus { explicit BuildStatus(const BuildConfig& config); void PlanHasTotalEdges(int total); void BuildEdgeStarted(const Edge* edge); - void BuildEdgeFinished(Edge* edge, bool success, const string& output, + void BuildEdgeFinished(Edge* edge, bool success, const std::string& output, int* start_time, int* end_time); void BuildLoadDyndeps(); void BuildStarted(); @@ -257,8 +257,8 @@ struct BuildStatus { /// placeholders. /// @param progress_status_format The format of the progress status. /// @param status The status of the edge. - string FormatProgressStatus(const char* progress_status_format, - EdgeStatus status) const; + std::string FormatProgressStatus(const char* progress_status_format, + EdgeStatus status) const; private: void PrintStatus(const Edge* edge, EdgeStatus status); @@ -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<const Edge*, int> RunningEdgeMap; + typedef std::map<const Edge*, int> RunningEdgeMap; RunningEdgeMap running_edges_; /// Prints progress output. @@ -327,7 +327,7 @@ struct BuildStatus { double rate_; Stopwatch stopwatch_; const size_t N; - queue<double> times_; + std::queue<double> times_; int last_update_; }; |