aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/module.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-04-14 14:43:43 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-04-14 14:43:43 +0200
commitaa29434a2feebc8925307372c27a5f56021620fc (patch)
tree3c1b84306268c245ac40e25c89a66f740a548152 /libbuild2/cc/module.hxx
parent7728fe67a610c437c3303170c3a254a751169338 (diff)
Add header cache to cc::compile_rule::enter_header()
Diffstat (limited to 'libbuild2/cc/module.hxx')
-rw-r--r--libbuild2/cc/module.hxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/libbuild2/cc/module.hxx b/libbuild2/cc/module.hxx
index a91d723..ee9349a 100644
--- a/libbuild2/cc/module.hxx
+++ b/libbuild2/cc/module.hxx
@@ -4,6 +4,8 @@
#ifndef LIBBUILD2_CC_MODULE_HXX
#define LIBBUILD2_CC_MODULE_HXX
+#include <unordered_map>
+
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
@@ -78,6 +80,15 @@ namespace build2
bool new_config = false; // See guess() and init() for details.
+ // Header cache (see compile_rule::enter_header()).
+ //
+ // We place it into the config module so that we have an option of
+ // sharing it for the entire weak amalgamation.
+ //
+ public:
+ mutable shared_mutex header_map_mutex;
+ mutable std::unordered_map<path, const file*> header_map;
+
private:
// Defined in gcc.cxx.
//
@@ -105,10 +116,10 @@ namespace build2
{
public:
explicit
- module (data&& d)
+ module (data&& d, const scope& rs)
: common (move (d)),
link_rule (move (d)),
- compile_rule (move (d)),
+ compile_rule (move (d), rs),
install_rule (move (d), *this),
libux_install_rule (move (d), *this) {}