mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
llvm-undname: Correctly demangle vararg parameters
FunctionSignatureNode already had an IsVariadic field, but it wasn't used anywhere yet. Set it and use it. llvm-svn: 362541
This commit is contained in:
parent
0df40efc5e
commit
3bcaa2c7da
@ -177,8 +177,9 @@ private:
|
||||
|
||||
ArrayTypeNode *demangleArrayType(StringView &MangledName);
|
||||
|
||||
NodeArrayNode *demangleFunctionParameterList(StringView &MangledName,
|
||||
bool &IsVariadic);
|
||||
NodeArrayNode *demangleTemplateParameterList(StringView &MangledName);
|
||||
NodeArrayNode *demangleFunctionParameterList(StringView &MangledName);
|
||||
|
||||
std::pair<uint64_t, bool> demangleNumber(StringView &MangledName);
|
||||
uint64_t demangleUnsigned(StringView &MangledName);
|
||||
|
@ -344,7 +344,7 @@ struct FunctionSignatureNode : public TypeNode {
|
||||
// Function parameters
|
||||
NodeArrayNode *Params = nullptr;
|
||||
|
||||
// True if the function type is noexcept
|
||||
// True if the function type is noexcept.
|
||||
bool IsNoexcept = false;
|
||||
};
|
||||
|
||||
|
@ -1826,7 +1826,7 @@ FunctionSignatureNode *Demangler::demangleFunctionType(StringView &MangledName,
|
||||
if (!IsStructor)
|
||||
FTy->ReturnType = demangleType(MangledName, QualifierMangleMode::Result);
|
||||
|
||||
FTy->Params = demangleFunctionParameterList(MangledName);
|
||||
FTy->Params = demangleFunctionParameterList(MangledName, FTy->IsVariadic);
|
||||
|
||||
FTy->IsNoexcept = demangleThrowSpecification(MangledName);
|
||||
|
||||
@ -2094,8 +2094,8 @@ ArrayTypeNode *Demangler::demangleArrayType(StringView &MangledName) {
|
||||
}
|
||||
|
||||
// Reads a function's parameters.
|
||||
NodeArrayNode *
|
||||
Demangler::demangleFunctionParameterList(StringView &MangledName) {
|
||||
NodeArrayNode *Demangler::demangleFunctionParameterList(StringView &MangledName,
|
||||
bool &IsVariadic) {
|
||||
// Empty parameter list.
|
||||
if (MangledName.consumeFront('X'))
|
||||
return nullptr;
|
||||
@ -2152,8 +2152,7 @@ Demangler::demangleFunctionParameterList(StringView &MangledName) {
|
||||
return NA;
|
||||
|
||||
if (MangledName.consumeFront('Z')) {
|
||||
// This is a variadic parameter list. We probably need a variadic node to
|
||||
// append to the end.
|
||||
IsVariadic = true;
|
||||
return NA;
|
||||
}
|
||||
|
||||
|
@ -414,6 +414,12 @@ void FunctionSignatureNode::outputPost(OutputStream &OS,
|
||||
Params->output(OS, Flags);
|
||||
else
|
||||
OS << "void";
|
||||
|
||||
if (IsVariadic) {
|
||||
if (OS.back() != '(')
|
||||
OS << ", ";
|
||||
OS << "...";
|
||||
}
|
||||
OS << ")";
|
||||
}
|
||||
|
||||
|
@ -39,8 +39,10 @@
|
||||
; CHECK: void __cdecl x(float, int)
|
||||
|
||||
?x@@YAXMHZZ
|
||||
; FIXME: This should be `(float, int, ...)`
|
||||
; CHECK: void __cdecl x(float, int)
|
||||
; CHECK: void __cdecl x(float, int, ...)
|
||||
|
||||
?x@@YAXZZ
|
||||
; CHECK: void __cdecl x(...)
|
||||
|
||||
?x@@3P6AHMNH@ZEA
|
||||
; CHECK: int (__cdecl *x)(float, double, int)
|
||||
|
Loading…
Reference in New Issue
Block a user