aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-04-02 08:03:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-04-02 08:03:55 +0200
commit87a7253a3bd82b59063172f3799b0a5587e7b2a5 (patch)
treee99ea1139bea536f02865fc9fcd06486676c0f73 /libbuild2/scope.hxx
parentcede94e8190ead8d2bc311e82348119d9abbfc3d (diff)
Detect and diagnose attempt to create new target in src directory
GitHub issue #277.
Diffstat (limited to 'libbuild2/scope.hxx')
-rw-r--r--libbuild2/scope.hxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx
index 968727b..09d61e9 100644
--- a/libbuild2/scope.hxx
+++ b/libbuild2/scope.hxx
@@ -793,6 +793,8 @@ namespace build2
// The first element, if not NULL, is for the "owning" out path. The rest
// of the elements are for the src path shallow references.
//
+ // Note that the global scope is in the first element.
+ //
struct scopes: small_vector<scope*, 3>
{
scopes () = default;
@@ -832,6 +834,10 @@ namespace build2
// Find all the scopes that encompass this path (out or src).
//
+ // If skip_null_out is false, then the first element always corresponds to
+ // the out scope and is NULL if there is none (see struct scopes above for
+ // details).
+ //
// Note that the returned range will never be empty (there is always the
// global scope).
//
@@ -864,7 +870,7 @@ namespace build2
// "island append" restriction we have on loading additional buildfile.
//
LIBBUILD2_SYMEXPORT pair<scopes::const_iterator, scopes::const_iterator>
- find (const dir_path&) const;
+ find (const dir_path&, bool skip_null_out = true) const;
const_iterator begin () const {return map_.begin ();}
const_iterator end () const {return map_.end ();}