aboutsummaryrefslogtreecommitdiff
path: root/build2/rule
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/rule
parenta1b2319ff2ddc8a6f139ee364cabe236ca62e23e (diff)
Implement support for C compilation
We now have two new modules: cc (c-common) and c.
Diffstat (limited to 'build2/rule')
-rw-r--r--build2/rule11
1 files changed, 11 insertions, 0 deletions
diff --git a/build2/rule b/build2/rule
index 03e4bf2..6d4a580 100644
--- a/build2/rule
+++ b/build2/rule
@@ -13,6 +13,9 @@
namespace build2
{
+ // @@ This is an ugly mess that is overdue for redesign. Perhaps
+ // something similar to variable value storage?
+ //
class match_result
{
public:
@@ -56,6 +59,14 @@ namespace build2
{
return target != nullptr || prerequisite != nullptr;
}
+
+ template <typename T>
+ T&
+ as_target () const
+ {
+ return static_cast<T&> (
+ target != nullptr ? *target : *prerequisite->target);
+ }
};
class rule