Skip to content

Commit

Permalink
Merge pull request #182 from chaoticgd/multifix
Browse files Browse the repository at this point in the history
Add non-const version of MultiSymbolHandle::lookup_symbol
  • Loading branch information
chaoticgd authored Feb 23, 2024
2 parents 4d01035 + 1d9be23 commit b0c637f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ccc/symbol_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ u32 MultiSymbolHandle::handle() const
return m_symbol_handle;
}

const Symbol* MultiSymbolHandle::lookup_symbol(const SymbolDatabase& database) const
Symbol* MultiSymbolHandle::lookup_symbol(SymbolDatabase& database)
{
if(m_symbol_handle != (u32) -1) {
switch(m_descriptor) {
Expand All @@ -993,6 +993,11 @@ const Symbol* MultiSymbolHandle::lookup_symbol(const SymbolDatabase& database) c
return nullptr;
}

const Symbol* MultiSymbolHandle::lookup_symbol(const SymbolDatabase& database) const
{
return const_cast<MultiSymbolHandle*>(this)->lookup_symbol(const_cast<SymbolDatabase&>(database));
}

#define CCC_X(SymbolType, symbol_list) template MultiSymbolHandle::MultiSymbolHandle(const SymbolType& symbol);
CCC_FOR_EACH_SYMBOL_TYPE_DO_X
#undef CCC_X
Expand Down
1 change: 1 addition & 0 deletions src/ccc/symbol_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,7 @@ class MultiSymbolHandle {
SymbolDescriptor descriptor() const;
u32 handle() const;

Symbol* lookup_symbol(SymbolDatabase& database);
const Symbol* lookup_symbol(const SymbolDatabase& database) const;

friend auto operator<=>(const MultiSymbolHandle& lhs, const MultiSymbolHandle& rhs) = default;
Expand Down

0 comments on commit b0c637f

Please sign in to comment.