SymbolDB: Add constructors to Symbol

Allows for much more convenient in-place construction.
This commit is contained in:
Lioncash
2023-05-02 16:04:45 -04:00
parent a14d8003f4
commit 15d1ae3a8a
2 changed files with 6 additions and 6 deletions

View File

@ -37,6 +37,9 @@ struct Symbol
Data, Data,
}; };
Symbol() = default;
explicit Symbol(const std::string& name) { Rename(name); }
void Rename(const std::string& symbol_name); void Rename(const std::string& symbol_name);
std::string name; std::string name;

View File

@ -67,12 +67,9 @@ void PPCSymbolDB::AddKnownSymbol(const Core::CPUThreadGuard& guard, u32 startAdd
else else
{ {
// new symbol. run analyze. // new symbol. run analyze.
Common::Symbol tf; auto& new_symbol = m_functions.emplace(startAddr, name).first->second;
tf.Rename(name); new_symbol.type = type;
tf.type = type; new_symbol.address = startAddr;
tf.address = startAddr;
auto& new_symbol = m_functions.emplace(startAddr, std::move(tf)).first->second;
if (new_symbol.type == Common::Symbol::Type::Function) if (new_symbol.type == Common::Symbol::Type::Function)
{ {