• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 typedef pair<Symbol, struct DepNode*> NamedDepNode;
33 
34 struct DepNode {
35   DepNode(Symbol output, bool is_phony, bool is_restat);
36   string DebugString();
37 
38   Symbol output;
39   vector<Value*> cmds;
40   vector<NamedDepNode> deps;
41   vector<NamedDepNode> order_onlys;
42   vector<NamedDepNode> parents;
43   bool has_rule;
44   bool is_default_target;
45   bool is_phony;
46   bool is_restat;
47   vector<Symbol> implicit_outputs;
48   vector<Symbol> actual_inputs;
49   vector<Symbol> actual_order_only_inputs;
50   Vars* rule_vars;
51   Var* depfile_var;
52   Var* ninja_pool_var;
53   Symbol output_pattern;
54   Loc loc;
55 };
56 
57 void InitDepNodePool();
58 void QuitDepNodePool();
59 
60 void MakeDep(Evaluator* ev,
61              const vector<const Rule*>& rules,
62              const unordered_map<Symbol, Vars*>& rule_vars,
63              const vector<Symbol>& targets,
64              vector<NamedDepNode>* nodes);
65 
66 #endif  // DEP_H_
67