aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/compile-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-02-07 07:10:09 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-02-07 07:10:09 +0200
commit6c1ea91ca421a1b899af091043abdb58c2ed57e0 (patch)
treeb2b529454d5d5e1f061eada6a030ca0898948a10 /libbuild2/cc/compile-rule.cxx
parent459228c4c577be5b58e6e09ddc9404b07c12aee6 (diff)
Use target::as instead of static_cast everywhere
Diffstat (limited to 'libbuild2/cc/compile-rule.cxx')
-rw-r--r--libbuild2/cc/compile-rule.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx
index 77d01c6..aaaa43c 100644
--- a/libbuild2/cc/compile-rule.cxx
+++ b/libbuild2/cc/compile-rule.cxx
@@ -2582,7 +2582,7 @@ namespace build2
if (ht != pts.back ())
{
- ht = static_cast<const file*> (pts.back ().target);
+ ht = &pts.back ().target->as<file> ();
rs = "ERROR expected header '" + ht->path ().string () +
"' to be found instead";
bad_error = true; // We expect an error from the compiler.
@@ -5672,7 +5672,7 @@ namespace build2
// Hash (we know it's a file).
//
- cs.append (static_cast<const file&> (*bt).path ().string ());
+ cs.append (bt->as<file> ().path ().string ());
// Copy over bmi{}s from our prerequisites weeding out duplicates.
//
@@ -5698,7 +5698,7 @@ namespace build2
}) == imports.end ())
{
pts.push_back (et);
- cs.append (static_cast<const file&> (*et).path ().string ());
+ cs.append (et->as<file> ().path ().string ());
// Add to the list of imports for further duplicate suppression.
// We could have stored reference to the name (e.g., in score)
@@ -5907,7 +5907,7 @@ namespace build2
nullopt, // Use default extension.
target_decl::implied,
trace));
- file& bt (static_cast<file&> (p.first));
+ file& bt (p.first.as<file> ());
// Note that this is racy and someone might have created this target
// while we were preparing the prerequisite list.
@@ -6142,7 +6142,7 @@ namespace build2
nullopt, // Use default extension.
target_decl::implied,
trace));
- file& bt (static_cast<file&> (p.first));
+ file& bt (p.first.as<file> ());
// Note that this is racy and someone might have created this target
// while we were preparing the prerequisite list.