FuncClass demangleFunctionClass(StringView &MangledName);
CallingConv demangleCallingConvention(StringView &MangledName);
StorageClass demangleVariableStorageClass(StringView &MangledName);
- void demangleThrowSpecification(StringView &MangledName);
+ bool demangleThrowSpecification(StringView &MangledName);
wchar_t demangleWcharLiteral(StringView &MangledName);
uint8_t demangleCharLiteral(StringView &MangledName);
// Function parameters
NodeArrayNode *Params = nullptr;
+
+ // True if the function type is noexcept
+ bool IsNoexcept = false;
};
struct IdentifierNode : public Node {
return Ty;
}
-void Demangler::demangleThrowSpecification(StringView &MangledName) {
+bool Demangler::demangleThrowSpecification(StringView &MangledName) {
+ if (MangledName.consumeFront("_E"))
+ return true;
if (MangledName.consumeFront('Z'))
- return;
+ return false;
Error = true;
+ return false;
}
FunctionSignatureNode *Demangler::demangleFunctionType(StringView &MangledName,
FTy->Params = demangleFunctionParameterList(MangledName);
- demangleThrowSpecification(MangledName);
+ FTy->IsNoexcept = demangleThrowSpecification(MangledName);
return FTy;
}
if (Quals & Q_Unaligned)
OS << " __unaligned";
+ if (IsNoexcept)
+ OS << " noexcept";
+
if (RefQualifier == FunctionRefQualifier::Reference)
OS << " &";
else if (RefQualifier == FunctionRefQualifier::RValueReference)
--- /dev/null
+; 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)