From 9fa5f73d00905568e8979d0c93ec4a8f645c81d5 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 9 Aug 2016 11:31:53 +0200 Subject: Implement support for C compilation We now have two new modules: cc (c-common) and c. --- build2/target-type | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'build2/target-type') diff --git a/build2/target-type b/build2/target-type index 6006b2c..6140ab1 100644 --- a/build2/target-type +++ b/build2/target-type @@ -46,12 +46,18 @@ namespace build2 target* (*search) (const prerequisite_key&); bool see_through; // A group with the default "see through" semantics. - bool - is_a (const target_type&) const; // Defined in target.cxx - template bool is_a () const {return is_a (T::static_type);} + + bool + is_a (const target_type& tt) const + { + return this == &tt || (base != nullptr && is_a_base (tt)); + } + + bool + is_a_base (const target_type&) const; // Defined in target.cxx }; inline bool @@ -97,12 +103,16 @@ namespace build2 class target_type_map: public target_type_map_base { public: - void - insert (const target_type& tt) {emplace (tt.name, target_type_ref (tt));} + const target_type& + insert (const target_type& tt) + { + emplace (tt.name, target_type_ref (tt)); + return tt; + } template - void - insert () {insert (T::static_type);} + const target_type& + insert () {return insert (T::static_type);} }; } -- cgit v1.1