aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/b.cxx2
-rw-r--r--build2/context10
-rw-r--r--build2/context.cxx22
-rw-r--r--build2/cxx/compile.cxx4
-rw-r--r--build2/parser.cxx2
-rw-r--r--build2/search.cxx2
6 files changed, 22 insertions, 20 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index dcf2cfe..1377d5b 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -879,7 +879,7 @@ main (int argc, char* argv[])
// Figure out if this target is in the src tree.
//
dir_path out (ts.out_base != ts.src_base && d.sub (ts.src_base)
- ? out_src (d, ts.out_base, ts.src_base)
+ ? out_src (d, rs)
: dir_path ());
mif->search (rs, target_key {ti, &d, &out, &tn.value, e}, l, tgs);
diff --git a/build2/context b/build2/context
index bdbdc80..30d29d1 100644
--- a/build2/context
+++ b/build2/context
@@ -114,21 +114,21 @@ namespace build2
rmdir_r (const dir_path&);
// Return the src/out directory corresponding to the given out/src. The
- // passed directory should be a sub-directory of out/src_base.
+ // passed directory should be a sub-directory of out/src_root.
//
dir_path
- src_out (const dir_path& out, scope&);
+ src_out (const dir_path& out, scope& root);
dir_path
src_out (const dir_path& out,
- const dir_path& out_base, const dir_path& src_base);
+ const dir_path& out_root, const dir_path& src_root);
dir_path
- out_src (const dir_path& src, scope&);
+ out_src (const dir_path& src, scope& root);
dir_path
out_src (const dir_path& src,
- const dir_path& out_base, const dir_path& src_base);
+ const dir_path& out_root, const dir_path& src_root);
// If possible and beneficial, translate an absolute, normalized path
// into relative to the relative_base directory, which is normally
diff --git a/build2/context.cxx b/build2/context.cxx
index a27d4ff..000d3b2 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -407,31 +407,33 @@ namespace build2
}
dir_path
- src_out (const dir_path& out, scope& s)
+ src_out (const dir_path& out, scope& r)
{
- return src_out (out, s.out_path (), s.src_path ());
+ assert (r.root ());
+ return src_out (out, r.out_path (), r.src_path ());
}
dir_path
- out_src (const dir_path& src, scope& s)
+ out_src (const dir_path& src, scope& r)
{
- return out_src (src, s.out_path (), s.src_path ());
+ assert (r.root ());
+ return out_src (src, r.out_path (), r.src_path ());
}
dir_path
src_out (const dir_path& o,
- const dir_path& out_base, const dir_path& src_base)
+ const dir_path& out_root, const dir_path& src_root)
{
- assert (o.sub (out_base));
- return src_base / o.leaf (out_base);
+ assert (o.sub (out_root));
+ return src_root / o.leaf (out_root);
}
dir_path
out_src (const dir_path& s,
- const dir_path& out_base, const dir_path& src_base)
+ const dir_path& out_root, const dir_path& src_root)
{
- assert (s.sub (src_base));
- return out_base / s.leaf (src_base);
+ assert (s.sub (src_root));
+ return out_root / s.leaf (src_root);
}
// relative()
diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx
index a7986c5..a0b4f3a 100644
--- a/build2/cxx/compile.cxx
+++ b/build2/cxx/compile.cxx
@@ -687,12 +687,12 @@ namespace build2
dir_path out;
scope& bs (scopes.find (d));
- if (bs.root_scope () != nullptr)
+ if (scope* rs = bs.root_scope ())
{
tt = map_extension (bs, n, *e);
if (bs.out_path () != bs.src_path () && d.sub (bs.src_path ()))
- out = out_src (d, bs);
+ out = out_src (d, *rs);
}
// If it is outside any project, or the project doesn't have
diff --git a/build2/parser.cxx b/build2/parser.cxx
index bd44f27..29af4be 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -2854,7 +2854,7 @@ namespace build2
scope_->src_path () != scope_->out_path () &&
d.sub (scope_->src_path ()))
{
- out = out_src (d, *scope_);
+ out = out_src (d, *root_);
}
const char* e (p.extension ());
diff --git a/build2/search.cxx b/build2/search.cxx
index cea7a7e..bff69e8 100644
--- a/build2/search.cxx
+++ b/build2/search.cxx
@@ -146,7 +146,7 @@ namespace build2
if (tk.out->empty ())
{
if (pk.scope->out_path () != s)
- out = out_src (d, *pk.scope);
+ out = out_src (d, *pk.scope->root_scope ());
}
else
out = *tk.out;