1
1
mirror of https://github.com/rui314/mold.git synced 2025-01-06 07:58:34 +03:00
mold/symtab.cc

15 lines
357 B
C++
Raw Normal View History

2020-10-09 16:29:25 +03:00
#include "chibild.h"
2020-10-18 14:19:57 +03:00
Symbol *Symbol::intern(StringRef name) {
typedef tbb::concurrent_hash_map<StringRef, Symbol> MapTy;
static MapTy map;
MapTy::accessor acc;
2020-10-18 14:22:23 +03:00
map.insert(acc, std::make_pair(name, Symbol(name)));
2020-10-18 08:41:02 +03:00
return &acc->second;
2020-10-09 16:29:25 +03:00
}
2020-10-18 14:19:57 +03:00
std::string toString(Symbol sym) {
return (StringRef(sym.name) + "(" + toString(sym.file) + ")").str();
2020-10-09 16:29:25 +03:00
}