mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 18:24:23 +00:00
LexicalScopes: Use debug info hierarchy pervasively
Pervasively use the types provided by the debug info hierarchy rather than `MDNode` in `LexicalScopes`. I noticed (again, I guess, based on comments in the implementation?) that `DILexicalBlockFile::getScope()` returns something different from `DILexicalBlockFile::getContext()`. I created a local helper for getting the same logic from `MDLexicalBlockFile` called `getScopeOfScope()`. I still don't really understand it, but I've added some FIXMEs and I'll come back to it (I suspect the way we encode these objects isn't really ideal). Note that my previous commit r233610 accidentally changed behaviour in `findLexicalScope()` -- it transitioned from a call to `DILexicalBlockFile::getScope()` to `MDLexicalBlockFile::getScope()` (sounds right, doesn't it?) -- so I've fixed that as a drive-by. No tests failed with my error, so it looks like we're missing some coverage here... when I come back to understand the logic, I'll see if I can add some. Other than the fix to `findLexicalScope()`, no functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233640 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -704,7 +704,8 @@ void DwarfDebug::ensureAbstractVariableIsCreated(const DIVariable &DV,
|
||||
if (getExistingAbstractVariable(DV, Cleansed))
|
||||
return;
|
||||
|
||||
createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope(ScopeNode));
|
||||
createAbstractVariable(Cleansed, LScopes.getOrCreateAbstractScope(
|
||||
cast<MDLocalScope>(ScopeNode)));
|
||||
}
|
||||
|
||||
void
|
||||
@ -714,7 +715,8 @@ DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(const DIVariable &DV,
|
||||
if (getExistingAbstractVariable(DV, Cleansed))
|
||||
return;
|
||||
|
||||
if (LexicalScope *Scope = LScopes.findAbstractScope(ScopeNode))
|
||||
if (LexicalScope *Scope =
|
||||
LScopes.findAbstractScope(cast_or_null<MDLocalScope>(ScopeNode)))
|
||||
createAbstractVariable(Cleansed, Scope);
|
||||
}
|
||||
|
||||
@ -901,10 +903,10 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
|
||||
continue;
|
||||
|
||||
LexicalScope *Scope = nullptr;
|
||||
if (MDNode *IA = DV.getInlinedAt())
|
||||
Scope = LScopes.findInlinedScope(DV.getContext(), IA);
|
||||
if (MDLocation *IA = DV.get()->getInlinedAt())
|
||||
Scope = LScopes.findInlinedScope(DV.get()->getScope(), IA);
|
||||
else
|
||||
Scope = LScopes.findLexicalScope(DV.getContext());
|
||||
Scope = LScopes.findLexicalScope(DV.get()->getScope());
|
||||
// If variable scope is not found then skip this variable.
|
||||
if (!Scope)
|
||||
continue;
|
||||
@ -943,7 +945,7 @@ DwarfDebug::collectVariableInfo(DwarfCompileUnit &TheCU, DISubprogram SP,
|
||||
assert(DV.isVariable());
|
||||
if (!Processed.insert(DV).second)
|
||||
continue;
|
||||
if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) {
|
||||
if (LexicalScope *Scope = LScopes.findLexicalScope(DV.get()->getScope())) {
|
||||
ensureAbstractVariableIsCreatedIfScoped(DV, Scope->getScopeNode());
|
||||
DIExpression NoExpr;
|
||||
ConcreteVariables.push_back(make_unique<DbgVariable>(DV, NoExpr, this));
|
||||
|
Reference in New Issue
Block a user