From a14b9bc18431c6aed8441261d28b6ff20bd25935 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Apr 2019 14:44:32 +0200 Subject: Initial take on header unit and include translation support --- build2/cc/utility.ixx | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'build2/cc/utility.ixx') 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}; } } } -- cgit v1.1