Fix the compiler to keep the original file/line information.
For a parameter we want to keep the base definition file/line information not the file/line information for the override.
This commit is contained in:
parent
965c77525c
commit
142f661737
8
PExpr.h
8
PExpr.h
|
|
@ -354,7 +354,7 @@ class PEIdent : public PExpr {
|
|||
NetExpr*elaborate_expr_param_(Design*des,
|
||||
NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*found,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
unsigned expr_wid,
|
||||
|
|
@ -362,21 +362,21 @@ class PEIdent : public PExpr {
|
|||
NetExpr*elaborate_expr_param_part_(Design*des,
|
||||
NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*found,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
unsigned expr_wid) const;
|
||||
NetExpr*elaborate_expr_param_idx_up_(Design*des,
|
||||
NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*found,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
bool need_const) const;
|
||||
NetExpr*elaborate_expr_param_idx_do_(Design*des,
|
||||
NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*found,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
bool need_const) const;
|
||||
|
|
|
|||
28
elab_expr.cc
28
elab_expr.cc
|
|
@ -2540,7 +2540,7 @@ static void warn_param_ob(long par_msv, long par_lsv, bool defined,
|
|||
|
||||
NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
bool need_const) const
|
||||
|
|
@ -2613,6 +2613,12 @@ NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope,
|
|||
base = normalize_variable_base(base, par_msv, par_lsv, wid, true);
|
||||
|
||||
NetExpr*tmp = par->dup_expr();
|
||||
if (!tmp) return 0;
|
||||
|
||||
/* The numeric parameter value needs to have the file and line
|
||||
* information for the actual parameter not the expression. */
|
||||
NetScope::param_ref_t pref = found_in->find_parameter(peek_tail_name(path_));
|
||||
tmp->set_line((*pref).second);
|
||||
tmp = new NetESelect(tmp, base, wid, IVL_SEL_IDX_UP);
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
|
|
@ -2620,7 +2626,7 @@ NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope,
|
|||
|
||||
NetExpr* PEIdent::elaborate_expr_param_idx_do_(Design*des, NetScope*scope,
|
||||
const NetExpr*par,
|
||||
NetScope*,
|
||||
NetScope*found_in,
|
||||
const NetExpr*par_msb,
|
||||
const NetExpr*par_lsb,
|
||||
bool need_const) const
|
||||
|
|
@ -2694,6 +2700,12 @@ NetExpr* PEIdent::elaborate_expr_param_idx_do_(Design*des, NetScope*scope,
|
|||
base = normalize_variable_base(base, par_msv, par_lsv, wid, false);
|
||||
|
||||
NetExpr*tmp = par->dup_expr();
|
||||
if (!tmp) return 0;
|
||||
|
||||
/* The numeric parameter value needs to have the file and line
|
||||
* information for the actual parameter not the expression. */
|
||||
NetScope::param_ref_t pref = found_in->find_parameter(peek_tail_name(path_));
|
||||
tmp->set_line((*pref).second);
|
||||
tmp = new NetESelect(tmp, base, wid, IVL_SEL_IDX_DOWN);
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
|
|
@ -2748,8 +2760,14 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des,
|
|||
// rewritten in the above format, as I get to it.
|
||||
|
||||
NetExpr*tmp = par->dup_expr();
|
||||
if (!tmp)
|
||||
return 0;
|
||||
if (!tmp) return 0;
|
||||
|
||||
/* The numeric parameter value needs to have the file and line
|
||||
* information for the actual parameter not the expression. */
|
||||
if (! dynamic_cast<NetEConstEnum*>(tmp)) {
|
||||
NetScope::param_ref_t pref = found_in->find_parameter(peek_tail_name(path_));
|
||||
tmp->set_line((*pref).second);
|
||||
}
|
||||
|
||||
if (use_sel == index_component_t::SEL_BIT) {
|
||||
ivl_assert(*this, !name_tail.index.empty());
|
||||
|
|
@ -2846,6 +2864,7 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des,
|
|||
|
||||
|
||||
NetEConst*re2 = new NetEConst(verinum(rb, 1));
|
||||
re2->set_line(*this);
|
||||
delete tmp;
|
||||
delete mtmp;
|
||||
tmp = re2;
|
||||
|
|
@ -2911,7 +2930,6 @@ NetExpr* PEIdent::elaborate_expr_param_(Design*des,
|
|||
}
|
||||
}
|
||||
|
||||
tmp->set_line(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __LineInfo_H
|
||||
#define __LineInfo_H
|
||||
/*
|
||||
* Copyright (c) 1999-2009 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -40,7 +40,7 @@ class LineInfo {
|
|||
|
||||
// Get a fully formatted file/lineno
|
||||
string get_fileline() const;
|
||||
// Set the file/line fro another LineInfo object.
|
||||
// Set the file/line from another LineInfo object.
|
||||
void set_line(const LineInfo&that);
|
||||
|
||||
// Access parts of LineInfo data
|
||||
|
|
|
|||
|
|
@ -641,8 +641,8 @@ void NetScope::evaluate_parameters(Design*des)
|
|||
cur->second->evaluate_parameters(des);
|
||||
|
||||
if (debug_scopes)
|
||||
cerr << ":0" << ": debug: "
|
||||
<< "Evaluate parameters in " << scope_path(this) << endl;
|
||||
cerr << "debug: "
|
||||
<< "Evaluating parameters in " << scope_path(this) << endl;
|
||||
|
||||
for (param_ref_t cur = parameters.begin()
|
||||
; cur != parameters.end() ; ++ cur) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue