aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/context.cxx8
-rw-r--r--libbuild2/context.hxx12
2 files changed, 11 insertions, 9 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx
index 87685ef..1cf7c7d 100644
--- a/libbuild2/context.cxx
+++ b/libbuild2/context.cxx
@@ -58,7 +58,7 @@ namespace build2
bool dr,
bool kg,
const strings& cmd_vars,
- optional<unique_ptr<context>> mc)
+ optional<context*> mc)
: data_ (new data (*this)),
sched (s),
dry_run_option (dr),
@@ -72,8 +72,10 @@ namespace build2
global_scope (create_global_scope (data_->scopes)),
global_target_types (data_->global_target_types),
global_override_cache (data_->global_override_cache),
- module_context (mc ? mc->get () : nullptr),
- module_context_storage (move (mc))
+ module_context (mc ? *mc : nullptr),
+ module_context_storage (mc
+ ? optional<unique_ptr<context>> (nullptr)
+ : nullopt)
{
tracer trace ("context");
diff --git a/libbuild2/context.hxx b/libbuild2/context.hxx
index 57ae65d..b5dbd3c 100644
--- a/libbuild2/context.hxx
+++ b/libbuild2/context.hxx
@@ -392,20 +392,20 @@ namespace build2
// setup to point to itself (see import_module() for details).
//
context* module_context;
- optional<unique_ptr<context>> module_context_storage; //@@ CTX: shared_ptr
+ optional<unique_ptr<context>> module_context_storage;
public:
- // If mod_ctx is absent, then automatic updating of build system modules
- // is disabled. If it is NULL, then the context will be created lazily if
- // and when necessary. Otherwise, it should be a properly setup context
- // (including, normally, a self-reference in modules_context).
+ // If module_context is absent, then automatic updating of build system
+ // modules is disabled. If it is NULL, then the context will be created
+ // lazily if and when necessary. Otherwise, it should be a properly setup
+ // context (including, normally, a self-reference in modules_context).
//
explicit
context (scheduler&,
bool dry_run = false,
bool keep_going = true,
const strings& cmd_vars = {},
- optional<unique_ptr<context>> mod_ctx = unique_ptr<context> ());
+ optional<context*> module_context = nullptr);
// Set current meta-operation and operation.
//