[DebugInfo] Sink DwarfDebug::addCurrentFnArgument down into DwarfFile.

Variable handling will be sunk into DwarfFile so that abstract variables
and the like can be shared across multiple CUs (to handle cross-CU
inlining, for example).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220453 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie
2014-10-23 00:16:05 +00:00
parent 22a01da9de
commit 87e9d8c051
3 changed files with 28 additions and 24 deletions

View File

@@ -794,29 +794,6 @@ DwarfDebug::ensureAbstractVariableIsCreatedIfScoped(const DIVariable &DV,
createAbstractVariable(Cleansed, Scope);
}
// If Var is a current function argument then add it to CurrentFnArguments list.
bool DwarfDebug::addCurrentFnArgument(DbgVariable *Var, LexicalScope *Scope) {
if (Scope->getParent())
return false;
DIVariable DV = Var->getVariable();
if (DV.getTag() != dwarf::DW_TAG_arg_variable)
return false;
unsigned ArgNo = DV.getArgNumber();
if (ArgNo == 0)
return false;
size_t Size = CurrentFnArguments.size();
if (Size == 0)
CurrentFnArguments.resize(CurFn->getFunction()->arg_size());
// llvm::Function argument size is not good indicator of how many
// arguments does the function have at source level.
if (ArgNo > Size)
CurrentFnArguments.resize(ArgNo * 2);
assert(!CurrentFnArguments[ArgNo - 1]);
CurrentFnArguments[ArgNo - 1] = Var;
return true;
}
// Collect variable information from side table maintained by MMI.
void DwarfDebug::collectVariableInfoFromMMITable(
SmallPtrSetImpl<const MDNode *> &Processed) {
@@ -1277,7 +1254,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
}
void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) {
if (addCurrentFnArgument(Var, LS))
if (InfoHolder.addCurrentFnArgument(Var, LS))
return;
addNonArgumentScopeVariable(LS, Var);
}