Shinichiro Hamaji | 1d545aa | 2015-06-23 15:29:13 +0900 | [diff] [blame] | 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 | |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 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" |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 24 | #include "symtab.h" |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 25 | |
Shinichiro Hamaji | ffc52c3 | 2015-06-23 16:51:07 +0900 | [diff] [blame] | 26 | class Evaluator; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 27 | class Rule; |
| 28 | class Value; |
Shinichiro Hamaji | 85e5ed0 | 2016-01-20 16:25:32 +0900 | [diff] [blame] | 29 | class Var; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 30 | class Vars; |
| 31 | |
| 32 | struct DepNode { |
Shinichiro Hamaji | 3ac2a09 | 2015-10-01 18:38:02 +0900 | [diff] [blame] | 33 | DepNode(Symbol output, bool is_phony, bool is_restat); |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 34 | |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 35 | Symbol output; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 36 | vector<Value*> cmds; |
| 37 | vector<DepNode*> deps; |
Shinichiro Hamaji | 183dbb9 | 2015-07-06 17:21:39 +0900 | [diff] [blame] | 38 | vector<DepNode*> order_onlys; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 39 | vector<DepNode*> parents; |
| 40 | bool has_rule; |
Colin Cross | 5b26db3 | 2015-09-29 16:51:02 -0700 | [diff] [blame] | 41 | bool is_default_target; |
Shinichiro Hamaji | 3ac2a09 | 2015-10-01 18:38:02 +0900 | [diff] [blame] | 42 | bool is_phony; |
| 43 | bool is_restat; |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 44 | vector<Symbol> actual_inputs; |
Shinichiro Hamaji | 3727d21 | 2016-02-19 15:21:32 +0900 | [diff] [blame] | 45 | vector<Symbol> actual_order_only_inputs; |
Shinichiro Hamaji | ffc52c3 | 2015-06-23 16:51:07 +0900 | [diff] [blame] | 46 | Vars* rule_vars; |
Shinichiro Hamaji | 85e5ed0 | 2016-01-20 16:25:32 +0900 | [diff] [blame] | 47 | Var* depfile_var; |
Shinichiro Hamaji | a7984ad | 2015-09-11 16:33:16 +0900 | [diff] [blame] | 48 | Symbol output_pattern; |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 49 | Loc loc; |
| 50 | }; |
| 51 | |
| 52 | void InitDepNodePool(); |
| 53 | void QuitDepNodePool(); |
| 54 | |
Shinichiro Hamaji | ffc52c3 | 2015-06-23 16:51:07 +0900 | [diff] [blame] | 55 | void MakeDep(Evaluator* ev, |
Shinichiro Hamaji | 7a2659e | 2016-02-08 14:32:56 +0900 | [diff] [blame] | 56 | const vector<const Rule*>& rules, |
Shinichiro Hamaji | e799275 | 2015-06-29 18:38:35 +0900 | [diff] [blame] | 57 | const unordered_map<Symbol, Vars*>& rule_vars, |
| 58 | const vector<Symbol>& targets, |
Shinichiro Hamaji | 776ca30 | 2015-06-06 03:52:48 +0900 | [diff] [blame] | 59 | vector<DepNode*>* nodes); |
| 60 | |
| 61 | #endif // DEP_H_ |