mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[llvm-undname] Add support for demangling msvc's noexcept types.
Starting in C++17, MSVC introduced a new mangling for function parameters that are themselves noexcept functions. This patch makes llvm-undname properly demangle them. Patch by Zachary Henkel Differential Revision: https://reviews.llvm.org/D55769 llvm-svn: 350656
This commit is contained in:
parent
6b32fb155c
commit
3475d3dfe8
@ -245,7 +245,7 @@ private:
|
|||||||
FuncClass demangleFunctionClass(StringView &MangledName);
|
FuncClass demangleFunctionClass(StringView &MangledName);
|
||||||
CallingConv demangleCallingConvention(StringView &MangledName);
|
CallingConv demangleCallingConvention(StringView &MangledName);
|
||||||
StorageClass demangleVariableStorageClass(StringView &MangledName);
|
StorageClass demangleVariableStorageClass(StringView &MangledName);
|
||||||
void demangleThrowSpecification(StringView &MangledName);
|
bool demangleThrowSpecification(StringView &MangledName);
|
||||||
wchar_t demangleWcharLiteral(StringView &MangledName);
|
wchar_t demangleWcharLiteral(StringView &MangledName);
|
||||||
uint8_t demangleCharLiteral(StringView &MangledName);
|
uint8_t demangleCharLiteral(StringView &MangledName);
|
||||||
|
|
||||||
|
@ -323,6 +323,9 @@ struct FunctionSignatureNode : public TypeNode {
|
|||||||
|
|
||||||
// Function parameters
|
// Function parameters
|
||||||
NodeArrayNode *Params = nullptr;
|
NodeArrayNode *Params = nullptr;
|
||||||
|
|
||||||
|
// True if the function type is noexcept
|
||||||
|
bool IsNoexcept = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IdentifierNode : public Node {
|
struct IdentifierNode : public Node {
|
||||||
|
@ -1681,11 +1681,14 @@ TypeNode *Demangler::demangleType(StringView &MangledName,
|
|||||||
return Ty;
|
return Ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Demangler::demangleThrowSpecification(StringView &MangledName) {
|
bool Demangler::demangleThrowSpecification(StringView &MangledName) {
|
||||||
|
if (MangledName.consumeFront("_E"))
|
||||||
|
return true;
|
||||||
if (MangledName.consumeFront('Z'))
|
if (MangledName.consumeFront('Z'))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
Error = true;
|
Error = true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionSignatureNode *Demangler::demangleFunctionType(StringView &MangledName,
|
FunctionSignatureNode *Demangler::demangleFunctionType(StringView &MangledName,
|
||||||
@ -1709,7 +1712,7 @@ FunctionSignatureNode *Demangler::demangleFunctionType(StringView &MangledName,
|
|||||||
|
|
||||||
FTy->Params = demangleFunctionParameterList(MangledName);
|
FTy->Params = demangleFunctionParameterList(MangledName);
|
||||||
|
|
||||||
demangleThrowSpecification(MangledName);
|
FTy->IsNoexcept = demangleThrowSpecification(MangledName);
|
||||||
|
|
||||||
return FTy;
|
return FTy;
|
||||||
}
|
}
|
||||||
|
@ -423,6 +423,9 @@ void FunctionSignatureNode::outputPost(OutputStream &OS,
|
|||||||
if (Quals & Q_Unaligned)
|
if (Quals & Q_Unaligned)
|
||||||
OS << " __unaligned";
|
OS << " __unaligned";
|
||||||
|
|
||||||
|
if (IsNoexcept)
|
||||||
|
OS << " noexcept";
|
||||||
|
|
||||||
if (RefQualifier == FunctionRefQualifier::Reference)
|
if (RefQualifier == FunctionRefQualifier::Reference)
|
||||||
OS << " &";
|
OS << " &";
|
||||||
else if (RefQualifier == FunctionRefQualifier::RValueReference)
|
else if (RefQualifier == FunctionRefQualifier::RValueReference)
|
||||||
|
25
test/Demangle/ms-cxx17-noexcept.test
Normal file
25
test/Demangle/ms-cxx17-noexcept.test
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
; RUN: llvm-undname < %s | FileCheck %s
|
||||||
|
|
||||||
|
; CHECK-NOT: Invalid mangled name
|
||||||
|
|
||||||
|
?nochange@@YAXXZ
|
||||||
|
; CHECK: void __cdecl nochange(void)
|
||||||
|
|
||||||
|
?a@@YAXP6AHXZ@Z
|
||||||
|
; CHECK: void __cdecl a(int (__cdecl *)(void))
|
||||||
|
?a@@YAXP6AHX_E@Z
|
||||||
|
; CHECK: void __cdecl a(int (__cdecl *)(void) noexcept)
|
||||||
|
|
||||||
|
?b@@YAXP6AHXZ@Z
|
||||||
|
; CHECK: void __cdecl b(int (__cdecl *)(void))
|
||||||
|
|
||||||
|
?c@@YAXP6AHXZ@Z
|
||||||
|
; CHECK: void __cdecl c(int (__cdecl *)(void))
|
||||||
|
?c@@YAXP6AHX_E@Z
|
||||||
|
; CHECK: void __cdecl c(int (__cdecl *)(void) noexcept)
|
||||||
|
|
||||||
|
?ee@?$e@$$A6AXXZ@@EEAAXXZ
|
||||||
|
; CHECK: private: virtual void __cdecl e<void __cdecl(void)>::ee(void)
|
||||||
|
|
||||||
|
?ee@?$e@$$A6AXX_E@@EEAAXXZ
|
||||||
|
; CHECK: private: virtual void __cdecl e<void __cdecl(void) noexcept>::ee(void)
|
Loading…
Reference in New Issue
Block a user