Fix several broken instances of function name generation.

- Use the artificial attribute to more intelligently determine when to omit
parameters. Fixes the first parameter on static class functions being
skipped incorrectly.

- Correctly handle varargs functions.
This commit is contained in:
Rene Gollent
2011-12-10 16:50:17 -05:00
parent 03da60709c
commit 216a2c7c89
+17 -10
View File
@@ -76,20 +76,25 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
DebugInfoEntryList::ConstIterator iterator
= subProgram->Parameters().GetIterator();
// this function is a class method, skip the first parameter
// as it supplies our 'this' pointer and shouldn't be visible
// in the signature
if (dynamic_cast<const DIECompoundType*>(subProgram->Parent()) != NULL)
iterator.Next();
bool firstParameter = true;
while (iterator.HasNext()) {
DebugInfoEntry* parameterEntry = iterator.Next();
if (dynamic_cast<DIEUnspecifiedParameters*>(parameterEntry)
!= NULL) {
parameters += ", ...";
continue;
}
const DIEFormalParameter* parameter
= dynamic_cast<DIEFormalParameter*>(iterator.Next());
= dynamic_cast<DIEFormalParameter*>(parameterEntry);
if (parameter == NULL) {
// this shouldn't happen
return;
}
if (parameter->IsArtificial())
continue;
BString paramName;
BString modifier;
DIEType* type = parameter->GetType();
@@ -133,10 +138,12 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
paramName += modifier;
}
parameters += paramName;
if (iterator.HasNext())
if (firstParameter)
firstParameter = false;
else
parameters += ", ";
parameters += paramName;
}
if (parameters.Length() > 0)