aboutsummaryrefslogtreecommitdiff
path: root/build2/target-type
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-09 11:31:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-12 17:04:22 +0200
commit9fa5f73d00905568e8979d0c93ec4a8f645c81d5 (patch)
treef2bf937fa256c0ef2c9bbe05d3655d1985719405 /build2/target-type
parenta1b2319ff2ddc8a6f139ee364cabe236ca62e23e (diff)
Implement support for C compilation
We now have two new modules: cc (c-common) and c.
Diffstat (limited to 'build2/target-type')
-rw-r--r--build2/target-type24
1 files changed, 17 insertions, 7 deletions
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 <typename T>
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 <typename T>
- void
- insert () {insert (T::static_type);}
+ const target_type&
+ insert () {return insert (T::static_type);}
};
}