aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/types.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-04-11 14:44:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-04-30 16:56:08 +0200
commita14b9bc18431c6aed8441261d28b6ff20bd25935 (patch)
treeae1f07caef838b5b03fa3f82a2cfccbb62b24ed3 /build2/cc/types.hxx
parentca0f9c71be279aee845bf5328ac0af8c02c8849e (diff)
Initial take on header unit and include translation support
Diffstat (limited to 'build2/cc/types.hxx')
-rw-r--r--build2/cc/types.hxx43
1 files changed, 25 insertions, 18 deletions
diff --git a/build2/cc/types.hxx b/build2/cc/types.hxx
index 56688ac..e10eca6 100644
--- a/build2/cc/types.hxx
+++ b/build2/cc/types.hxx
@@ -16,35 +16,41 @@ namespace build2
{
// Translation unit information.
//
+ // We use absolute and normalized header path as the header unit module
+ // name.
+ //
+ // Note that our terminology doesn't exactly align with the (current)
+ // standard where a header unit is not a module (that is, you either
+ // import a module unit or a header unit).
+ //
+ enum class unit_type
+ {
+ non_modular,
+ module_iface,
+ module_impl,
+ module_header
+ };
+
struct module_import
{
- string name;
- bool exported; // True if re-exported (export import M;).
- size_t score; // See compile::search_modules().
+ unit_type type; // Either module_iface or module_header.
+ string name;
+ bool exported; // True if re-exported (export import M;).
+ size_t score; // Match score (see compile::search_modules()).
};
using module_imports = vector<module_import>;
struct module_info
{
- string name; // Not empty if a module unit.
- bool iface = false; // True if a module interface unit.
- module_imports imports; // Imported modules.
+ string name; // Empty if non-modular.
+ module_imports imports; // Imported modules.
};
- enum class translation_type {plain, module_iface, module_impl};
-
- struct translation_unit
+ struct unit
{
- module_info mod;
-
- translation_type
- type () const
- {
- return (mod.name.empty () ? translation_type::plain :
- mod.iface ? translation_type::module_iface
- : translation_type::module_impl);
- }
+ unit_type type;
+ build2::cc::module_info module_info;
};
// Compiler language.
@@ -78,6 +84,7 @@ namespace build2
{
const target_type& obj;
const target_type& bmi;
+ const target_type& hbmi;
};
// Library link order.