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> actual_inputs;
45   vector<Symbol> actual_order_only_inputs;
46   Vars* rule_vars;
47   Var* depfile_var;
48   Symbol output_pattern;
49   Loc loc;
50 };
51 
52 void InitDepNodePool();
53 void QuitDepNodePool();
54 
55 void MakeDep(Evaluator* ev,
56              const vector<const Rule*>& rules,
57              const unordered_map<Symbol, Vars*>& rule_vars,
58              const vector<Symbol>& targets,
59              vector<DepNode*>* nodes);
60 
61 #endif  // DEP_H_
62