Skip to content

Commit

Permalink
[ASM] Fix function duplication error
Browse files Browse the repository at this point in the history
  • Loading branch information
tgtakaoka committed Mar 18, 2024
1 parent 0959047 commit 08ffe30
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions cli/asm_commander.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ int AsmCommander::assemble() {
fprintf(stderr, "%s: Pass %d\n", _input_name, ++pass);
prev.swap(memory);
symbols.copy(_driver.symbols());
_driver.symbols().clearFunctions();
memory.clear();
listout.clear();
errorout.clear();
Expand Down
4 changes: 4 additions & 0 deletions driver/symbol_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ void SymbolStoreImpl::copy(const SymbolStoreImpl &other) {
void SymbolStoreImpl::clear() {
_symbols.clear();
_variables.clear();
clearFunctions();
}

void SymbolStoreImpl::clearFunctions() {
_functions.clear();
}

Expand Down
1 change: 1 addition & 0 deletions driver/symbol_store.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ struct SymbolStoreImpl final : SymbolStore {
bool operator!=(const SymbolStoreImpl &other) const { return !(*this == other); }
void copy(const SymbolStoreImpl &other);
void clear();
void clearFunctions();

// SymbolTable
const char *lookupValue(uint32_t) const override { return nullptr; }
Expand Down

0 comments on commit 08ffe30

Please sign in to comment.