Extend handling in GetFunctionScopeName()

Now supports passing in:
DISubprogram
DILexicalBlock

In addition to existing support for:
DILocalVariable
DIGlobalVariable
This commit is contained in:
Jake Turner
2025-01-08 10:29:10 +00:00
parent 1c8766bd85
commit 1c7deb7df7
@@ -415,11 +415,19 @@ rdcstr Program::GetDebugVarName(const DIBase *d) const
rdcstr Program::GetFunctionScopeName(const DIBase *d) const
{
if(d->type == DIBase::Subprogram)
{
const rdcstr *name = d->As<DISubprogram>()->name;
return name ? *name : "";
}
const Metadata *scope = NULL;
if(d->type == DIBase::LocalVariable)
scope = d->As<DILocalVariable>()->scope;
if(d->type == DIBase::GlobalVariable)
else if(d->type == DIBase::GlobalVariable)
scope = d->As<DIGlobalVariable>()->scope;
else if(d->type == DIBase::LexicalBlock)
scope = d->As<DILexicalBlock>()->scope;
while(scope && scope->dwarf)
{