diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-10 17:27:55 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 1821a11704143a89581b26e285d968230b86a8ac (patch) | |
tree | bee33a148ec205157195fd55fd8a0d24db4fc3d2 /build2/variable.cxx | |
parent | dbd30777d1c60bdcdff226b5f97582dba0bba4ba (diff) |
Track variable value modifications
Diffstat (limited to 'build2/variable.cxx')
-rw-r--r-- | build2/variable.cxx | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/build2/variable.cxx b/build2/variable.cxx index 48f3345..7e105e6 100644 --- a/build2/variable.cxx +++ b/build2/variable.cxx @@ -1146,6 +1146,8 @@ namespace build2 load_generation == 0 || v.generation == load_generation); + // We assume typification is not modification. + // build2::typify (v, *var.type, &var); } @@ -1169,22 +1171,14 @@ namespace build2 } auto variable_map:: - find (const variable& var, bool typed) -> value_data* + find_to_modify (const variable& var, bool typed) -> value_data* { - auto i (m_.find (var)); - value_data* r (i != m_.end () ? &i->second : nullptr); + auto* r (const_cast<value_data*> (find (var, typed))); - // First access after being assigned a type? - // - if (r != nullptr && typed && var.type != nullptr && r->type != var.type) - { - // All values shall be typed during load. - // - assert (!global_ || phase == run_phase::load); - typify (*r, var); - } + if (r != nullptr) + r->version++; - return r; + return r; } pair<reference_wrapper<value>, bool> variable_map:: @@ -1205,6 +1199,8 @@ namespace build2 typify (r, var); } + r.version++; + return make_pair (reference_wrapper<value> (r), p.second); } |