diff options
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/verilog_frontend.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/frontends/verilog/verilog_frontend.cc b/frontends/verilog/verilog_frontend.cc index e2aecd99b..5907707c8 100644 --- a/frontends/verilog/verilog_frontend.cc +++ b/frontends/verilog/verilog_frontend.cc @@ -61,8 +61,11 @@ static void add_package_types(dict<std::string, AST::AstNode *> &user_types, std } } } - user_type_stack.clear(); - user_type_stack.push_back(new UserTypeMap()); + + // carry over typedefs from previous files, but allow them to be overridden + // note that these type maps are currently never reclaimed + if (user_type_stack.empty() || !user_type_stack.back()->empty()) + user_type_stack.push_back(new UserTypeMap()); } struct VerilogFrontend : public Frontend { |