From 9f06724c0aa79957a9a3797f4fa89393bed98369 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Mon, 12 Oct 2020 15:32:27 +0900 Subject: [PATCH] temporary --- chibild.h | 2 +- symtab.cc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chibild.h b/chibild.h index 7c409d2b..4d07ad47 100644 --- a/chibild.h +++ b/chibild.h @@ -110,7 +110,7 @@ struct tbb_hash_compare { class SymbolTable { public: - void add(StringRef key, Symbol sym); + Symbol *add(StringRef key, Symbol sym); Symbol *get(StringRef key); std::vector get_keys(); diff --git a/symtab.cc b/symtab.cc index 3506932f..0d502edf 100644 --- a/symtab.cc +++ b/symtab.cc @@ -1,10 +1,12 @@ #include "chibild.h" -void SymbolTable::add(StringRef name, Symbol sym) { +Symbol *SymbolTable::add(StringRef name, Symbol sym) { MapType::accessor acc; map.insert(acc, name); - acc->second = sym; + if (acc->second.file == nullptr) + acc->second = sym; acc.release(); + return nullptr; } Symbol *SymbolTable::get(StringRef name) {