aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/search.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-03-31 13:20:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-03-31 13:20:37 +0200
commiteed93abebc20e59f861c7e8b6322f7ef3681c59e (patch)
treefa61f29b25170b376831127a44ed412abd769191 /libbuild2/search.cxx
parent0e0a5903b7b7a03b500d40a10baf64a4bd77d0bd (diff)
Get rid of unnecessary dynamic_cast call
Diffstat (limited to 'libbuild2/search.cxx')
-rw-r--r--libbuild2/search.cxx8
1 files changed, 5 insertions, 3 deletions
diff --git a/libbuild2/search.cxx b/libbuild2/search.cxx
index fca19ea..d3638d7 100644
--- a/libbuild2/search.cxx
+++ b/libbuild2/search.cxx
@@ -86,6 +86,10 @@ namespace build2
const target_key& ctk (cpk.tk);
const scope* s (cpk.scope);
+ // Has to be a file target.
+ //
+ assert (ctk.type->is_a<file> ());
+
path f;
if (ctk.dir->absolute ())
@@ -191,9 +195,7 @@ namespace build2
target_decl::prereq_file,
trace));
- // Has to be a file_target.
- //
- const file& t (dynamic_cast<const file&> (r.first));
+ const file& t (r.first.as<file> ());
l5 ([&]{trace << (r.second ? "new" : "existing") << " target " << t
<< " for prerequisite " << cpk;});