1 // Copyright 2015 Google Inc. All rights reserved
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef DEP_H_
16 #define DEP_H_
17 
18 #include <string>
19 #include <unordered_map>
20 #include <vector>
21 
22 #include "loc.h"
23 #include "string_piece.h"
24 #include "symtab.h"
25 
26 class Evaluator;
27 class Rule;
28 class Value;
29 class Var;
30 class Vars;
31 
32 struct DepNode {
33   DepNode(Symbol output, bool is_phony, bool is_restat);
34 
35   Symbol output;
36   vector<Value*> cmds;
37   vector<DepNode*> deps;
38   vector<DepNode*> order_onlys;
39   vector<DepNode*> parents;
40   bool has_rule;
41   bool is_default_target;
42   bool is_phony;
43   bool is_restat;
44   vector<Symbol> implicit_outputs;
45   vector<Symbol> actual_inputs;
46   vector<Symbol> actual_order_only_inputs;
47   Vars* rule_vars;
48   Var* depfile_var;
49   Var* ninja_pool_var;
50   Symbol output_pattern;
51   Loc loc;
52 };
53 
54 void InitDepNodePool();
55 void QuitDepNodePool();
56 
57 void MakeDep(Evaluator* ev,
58              const vector<const Rule*>& rules,
59              const unordered_map<Symbol, Vars*>& rule_vars,
60              const vector<Symbol>& targets,
61              vector<DepNode*>* nodes);
62 
63 #endif  // DEP_H_
64