blob: 430299713f41e53c30341710ac0712f731762a71 [file] [log] [blame]
Shinichiro Hamaji1d545aa2015-06-23 15:29:13 +09001// 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 Hamaji776ca302015-06-06 03:52:48 +090015#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 Hamajie7992752015-06-29 18:38:35 +090024#include "symtab.h"
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090025
Shinichiro Hamajiffc52c32015-06-23 16:51:07 +090026class Evaluator;
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090027class Rule;
28class Value;
Shinichiro Hamaji85e5ed02016-01-20 16:25:32 +090029class Var;
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090030class Vars;
31
32struct DepNode {
Shinichiro Hamaji3ac2a092015-10-01 18:38:02 +090033 DepNode(Symbol output, bool is_phony, bool is_restat);
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090034
Shinichiro Hamajie7992752015-06-29 18:38:35 +090035 Symbol output;
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090036 vector<Value*> cmds;
37 vector<DepNode*> deps;
Shinichiro Hamaji183dbb92015-07-06 17:21:39 +090038 vector<DepNode*> order_onlys;
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090039 vector<DepNode*> parents;
40 bool has_rule;
Colin Cross5b26db32015-09-29 16:51:02 -070041 bool is_default_target;
Shinichiro Hamaji3ac2a092015-10-01 18:38:02 +090042 bool is_phony;
43 bool is_restat;
Shinichiro Hamajie7992752015-06-29 18:38:35 +090044 vector<Symbol> actual_inputs;
Shinichiro Hamaji3727d212016-02-19 15:21:32 +090045 vector<Symbol> actual_order_only_inputs;
Shinichiro Hamajiffc52c32015-06-23 16:51:07 +090046 Vars* rule_vars;
Shinichiro Hamaji85e5ed02016-01-20 16:25:32 +090047 Var* depfile_var;
Shinichiro Hamajia7984ad2015-09-11 16:33:16 +090048 Symbol output_pattern;
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090049 Loc loc;
50};
51
52void InitDepNodePool();
53void QuitDepNodePool();
54
Shinichiro Hamajiffc52c32015-06-23 16:51:07 +090055void MakeDep(Evaluator* ev,
Shinichiro Hamaji7a2659e2016-02-08 14:32:56 +090056 const vector<const Rule*>& rules,
Shinichiro Hamajie7992752015-06-29 18:38:35 +090057 const unordered_map<Symbol, Vars*>& rule_vars,
58 const vector<Symbol>& targets,
Shinichiro Hamaji776ca302015-06-06 03:52:48 +090059 vector<DepNode*>* nodes);
60
61#endif // DEP_H_