From beaf44895ac4f984730baa0b7fb394164208082f Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Sun, 26 Jul 2026 14:32:54 -0700 Subject: [PATCH] Use LineInfo::set_line() to copy source locations Some elaboration paths copy the file and line from a LineInfo object individually. Use set_line() instead. This keeps the copies together when LineInfo is extended with additional source location information. Signed-off-by: Lars-Peter Clausen --- elaborate.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index 5fb337569..1c19c6a81 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -2775,8 +2775,7 @@ NetAssign_* PAssign_::elaborate_lval(Design*des, NetScope*scope) const tmp = new NetNet(scope, scope->local_symbol(), NetNet::REG, tmp_vec); } - tmp->set_file(rval_->get_file()); - tmp->set_lineno(rval_->get_lineno()); + tmp->set_line(*rval_); NetAssign_*lv = new NetAssign_(tmp); return lv; } @@ -4607,12 +4606,10 @@ NetProc *PCallTask::elaborate_non_void_function_(Design *des, NetScope *scope) c { // Generate a function call version of this task call. PExpr*rval = new PECallFunction(package_, path_, parms_); - rval->set_file(get_file()); - rval->set_lineno(get_lineno()); + rval->set_line(*this); // Generate an assign to nothing. PAssign*tmp = new PAssign(0, rval); - tmp->set_file(get_file()); - tmp->set_lineno(get_lineno()); + tmp->set_line(*this); if (!void_cast_) { cerr << get_fileline() << ": warning: User function '" << peek_tail_name(path_) << "' is being called as a task." << endl;