diff options
author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-07-21 16:44:44 +0200 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2013-07-21 16:44:44 +0200 |
commit | fea898b7fa5aea0ea3d688bce03b1184ab6842e8 (patch) | |
tree | be6091811505bcac0bc6e2dda5e93e61d0afc2fc /lib/CodeGen/AsmPrinter/DwarfDebug.cpp | |
parent | 46ef71a74329a0777e3464c65927cd3e59c928d6 (diff) | |
parent | f667db3652e1fd198ce4e3aec4cebf080a124552 (diff) | |
download | llvm-fea898b7fa5aea0ea3d688bce03b1184ab6842e8.tar.gz llvm-fea898b7fa5aea0ea3d688bce03b1184ab6842e8.tar.bz2 llvm-fea898b7fa5aea0ea3d688bce03b1184ab6842e8.tar.xz |
Merge branch 'release_33' of git://github.com/llvm-mirror/llvm into embtk-support-release-3.3
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfDebug.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 73bba6989f..1e706ccf1e 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1624,9 +1624,37 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { } void DwarfDebug::addScopeVariable(LexicalScope *LS, DbgVariable *Var) { -// SmallVector<DbgVariable *, 8> &Vars = ScopeVariables.lookup(LS); - ScopeVariables[LS].push_back(Var); -// Vars.push_back(Var); + SmallVectorImpl<DbgVariable *> &Vars = ScopeVariables[LS]; + DIVariable DV = Var->getVariable(); + if (DV.getTag() == dwarf::DW_TAG_arg_variable) { + DISubprogram Ctxt(DV.getContext()); + DIArray Variables = Ctxt.getVariables(); + // If the variable is a parameter (arg_variable) and this is an optimized + // build (the subprogram has a 'variables' list) make sure we keep the + // parameters in order. Otherwise we would produce an incorrect function + // type with parameters out of order if function parameters were used out of + // order or unused (see the call to addScopeVariable in endFunction where + // the remaining unused variables (including parameters) are added). + if (unsigned NumVariables = Variables.getNumElements()) { + // Keep the parameters at the start of the variables list. Search through + // current variable list (Vars) and the full function variable list in + // lock-step looking for this parameter in the full list to find the + // insertion point. + SmallVectorImpl<DbgVariable *>::iterator I = Vars.begin(); + unsigned j = 0; + while (I != Vars.end() && j != NumVariables && + Variables.getElement(j) != DV && + (*I)->getVariable().getTag() == dwarf::DW_TAG_arg_variable) { + if (Variables.getElement(j) == (*I)->getVariable()) + ++I; + ++j; + } + Vars.insert(I, Var); + return; + } + } + + Vars.push_back(Var); } // Gather and emit post-function debug information. |