diff options
Diffstat (limited to 'qtmips_machine/symboltable.cpp')
-rw-r--r-- | qtmips_machine/symboltable.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qtmips_machine/symboltable.cpp b/qtmips_machine/symboltable.cpp index f22acaa..d26491f 100644 --- a/qtmips_machine/symboltable.cpp +++ b/qtmips_machine/symboltable.cpp @@ -66,6 +66,15 @@ void SymbolTable::add_symbol(QString name, std::uint32_t value, std::uint32_t si map_name_to_symbol.insert(name, p_ste); } +void SymbolTable::remove_symbol(QString name) { + SymbolTableEntry *p_ste = map_name_to_symbol.value(name); + if (p_ste == nullptr) + return; + map_name_to_symbol.remove(name); + map_value_to_symbol.remove(p_ste->value, p_ste); + delete p_ste; +} + bool SymbolTable::name_to_value(std::uint32_t &value, QString name) const { SymbolTableEntry *p_ste = map_name_to_symbol.value(name); if (p_ste == nullptr) { |