diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-14 09:47:40 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-14 09:47:40 +0200 |
commit | 8276259438592439236341b74300cb5538303c83 (patch) | |
tree | 0e072ee31bd13ff55f2c3e0d4a0b50725f8dd73f /build/scope | |
parent | 70613e9be046c9cddd2486505a44d3a0324d6d95 (diff) |
Add notion of strong/weak amalgamation, make strong new clean boundary
Diffstat (limited to 'build/scope')
-rw-r--r-- | build/scope | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/build/scope b/build/scope index 817ee95..eb2dafc 100644 --- a/build/scope +++ b/build/scope @@ -43,6 +43,20 @@ namespace build scope* root_scope () const {return root_;} + // Root scope of a strong amalgamation of this scope or NULL if + // this scope is not (yet) in any (known) project. If there is + // no strong amalgamation, then this function returns the root + // scope of the project (in other words, in this case a project + // is treated as its own strong amalgamation). + // + scope* + strong_scope () const + { + return root_ != nullptr + ? root_->strong_ != nullptr ? root_->strong_ : root_ + : nullptr; + } + bool root () const {return root_ == this;} @@ -140,11 +154,18 @@ namespace build friend class scope_map; friend class temp_scope; + // These two from <build/file> set strong_. + // + friend void create_bootstrap_outer (scope&); + friend scope& create_bootstrap_inner (scope&, const dir_path&); + scope () = default; const dir_path* path_; // Pointer to the key in scope_map. scope* parent_; scope* root_; + scope* strong_ = nullptr; // Only set on root sopes. + // NULL means no strong amalgamtion. }; // Temporary scope. The idea is to be able to create a temporary @@ -158,7 +179,13 @@ namespace build class temp_scope: public scope { public: - temp_scope (scope& p) {path_ = p.path_; parent_ = &p; root_ = p.root_;} + temp_scope (scope& p) + { + path_ = p.path_; + parent_ = &p; + root_ = p.root_; + // No need to copy strong_ since we are never root scope. + } }; using scope_map_base = butl::dir_path_map<scope>; |