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 DebugInfoEntryList::ConstIterator iterator
= subProgram->Parameters().GetIterator(); = subProgram->Parameters().GetIterator();
// this function is a class method, skip the first parameter bool firstParameter = true;
// as it supplies our 'this' pointer and shouldn't be visible
// in the signature
if (dynamic_cast<const DIECompoundType*>(subProgram->Parent()) != NULL)
iterator.Next();
while (iterator.HasNext()) { while (iterator.HasNext()) {
DebugInfoEntry* parameterEntry = iterator.Next();
if (dynamic_cast<DIEUnspecifiedParameters*>(parameterEntry)
!= NULL) {
parameters += ", ...";
continue;
}
const DIEFormalParameter* parameter const DIEFormalParameter* parameter
= dynamic_cast<DIEFormalParameter*>(iterator.Next()); = dynamic_cast<DIEFormalParameter*>(parameterEntry);
if (parameter == NULL) { if (parameter == NULL) {
// this shouldn't happen // this shouldn't happen
return; return;
} }
if (parameter->IsArtificial())
continue;
BString paramName; BString paramName;
BString modifier; BString modifier;
DIEType* type = parameter->GetType(); DIEType* type = parameter->GetType();
@@ -133,10 +138,12 @@ DwarfUtils::GetFullDIEName(const DebugInfoEntry* entry, BString& _name)
paramName += modifier; paramName += modifier;
} }
parameters += paramName; if (firstParameter)
firstParameter = false;
if (iterator.HasNext()) else
parameters += ", "; parameters += ", ";
parameters += paramName;
} }
if (parameters.Length() > 0) if (parameters.Length() > 0)