aboutsummaryrefslogtreecommitdiff
path: root/var.cc
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-10-09 11:23:32 -0700
committerDan Willemsen <dwillemsen@google.com>2017-10-13 13:21:27 -0700
commit36e5729db554afaea6fe9b23f3caa87b6c8cc80d (patch)
tree482b20ea2fcb0a6d5d112af75623eb690c12f9cb /var.cc
parentf2a0a72d1fd1ee7b6f37754eef8886dcaafa22d0 (diff)
downloadkati-36e5729db554afaea6fe9b23f3caa87b6c8cc80d.tar.gz
Keep track of stack usage, report line that used the most
This won't keep track of everything, but was useful in tracking down some recursive variables in the android build that shouldn't have been recursive (they were using 1MB+ of stack). Change-Id: I5e6b70480cffbebb09dfd72276017559480da948
Diffstat (limited to 'var.cc')
-rw-r--r--var.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/var.cc b/var.cc
index 27d92c7..14ccee6 100644
--- a/var.cc
+++ b/var.cc
@@ -59,7 +59,8 @@ SimpleVar::SimpleVar(VarOrigin origin) : origin_(origin) {}
SimpleVar::SimpleVar(const string& v, VarOrigin origin)
: v_(v), origin_(origin) {}
-void SimpleVar::Eval(Evaluator*, string* s) const {
+void SimpleVar::Eval(Evaluator* ev, string* s) const {
+ ev->CheckStack();
*s += v_;
}
@@ -82,10 +83,12 @@ RecursiveVar::RecursiveVar(Value* v, VarOrigin origin, StringPiece orig)
: v_(v), origin_(origin), orig_(orig) {}
void RecursiveVar::Eval(Evaluator* ev, string* s) const {
+ ev->CheckStack();
v_->Eval(ev, s);
}
-void RecursiveVar::AppendVar(Evaluator*, Value* v) {
+void RecursiveVar::AppendVar(Evaluator* ev, Value* v) {
+ ev->CheckStack();
v_ = NewExpr3(v_, NewLiteral(" "), v);
}