From d593b19735eec451b091fd46e4cb066e3478d6c9 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 29 Nov 2022 14:02:20 +0200 Subject: Move buildfiles to root_extra, use vector instead of unordered_set --- libbuild2/scope.hxx | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'libbuild2/scope.hxx') diff --git a/libbuild2/scope.hxx b/libbuild2/scope.hxx index 7989d59..3d31ff1 100644 --- a/libbuild2/scope.hxx +++ b/libbuild2/scope.hxx @@ -4,8 +4,6 @@ #ifndef LIBBUILD2_SCOPE_HXX #define LIBBUILD2_SCOPE_HXX -#include - #include #include #include @@ -302,13 +300,6 @@ namespace build2 // variable_type_map target_vars; - // Set of buildfiles already loaded for this scope. The included - // buildfiles are checked against the project's root scope while - // imported -- against the global scope (global_scope). - // - public: - std::unordered_set buildfiles; - // Target types. // // Note that target types are project-wide (even if the module that @@ -523,6 +514,25 @@ namespace build2 // module_map modules; + // Buildfiles already loaded for this project. + // + // We don't expect too many of them per project so let's use vector + // with linear search. + // + paths buildfiles; + + bool + insert_buildfile (const path& f) + { + bool r (find (buildfiles.begin (), + buildfiles.end (), + f) == buildfiles.end ()); + if (r) + buildfiles.push_back (f); + + return r; + } + // Variable override cache. // mutable variable_override_cache override_cache; -- cgit v1.1