aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/utility.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/cc/utility.ixx')
-rw-r--r--build2/cc/utility.ixx36
1 files changed, 28 insertions, 8 deletions
diff --git a/build2/cc/utility.ixx b/build2/cc/utility.ixx
index 2790bf6..609f8de 100644
--- a/build2/cc/utility.ixx
+++ b/build2/cc/utility.ixx
@@ -7,13 +7,20 @@ namespace build2
namespace cc
{
inline otype
- compile_type (const target& t, bool mod)
+ compile_type (const target& t, unit_type u)
{
using namespace bin;
+ auto test = [&t, u] (const auto& h, const auto& i, const auto& o)
+ {
+ return t.is_a (u == unit_type::module_header ? h :
+ u == unit_type::module_iface ? i :
+ o);
+ };
+
return
- t.is_a (mod ? bmie::static_type : obje::static_type) ? otype::e :
- t.is_a (mod ? bmia::static_type : obja::static_type) ? otype::a :
+ test (hbmie::static_type, bmie::static_type, obje::static_type) ? otype::e :
+ test (hbmia::static_type, bmia::static_type, obja::static_type) ? otype::a :
otype::s;
}
@@ -38,16 +45,29 @@ namespace build2
using namespace bin;
const target_type* o (nullptr);
- const target_type* m (nullptr);
+ const target_type* i (nullptr);
+ const target_type* h (nullptr);
switch (t)
{
- case otype::e: o = &obje::static_type; m = &bmie::static_type; break;
- case otype::a: o = &obja::static_type; m = &bmia::static_type; break;
- case otype::s: o = &objs::static_type; m = &bmis::static_type; break;
+ case otype::e:
+ o = &obje::static_type;
+ i = &bmie::static_type;
+ h = &hbmie::static_type;
+ break;
+ case otype::a:
+ o = &obja::static_type;
+ i = &bmia::static_type;
+ h = &hbmia::static_type;
+ break;
+ case otype::s:
+ o = &objs::static_type;
+ i = &bmis::static_type;
+ h = &hbmis::static_type;
+ break;
}
- return compile_target_types {*o, *m};
+ return compile_target_types {*o, *i, *h};
}
}
}