1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[MS Demangler] Print public:, protected:, private: if set in FunctionClass or a variable's StorageClass.

undname prints them, and the information is in the decorated name, so we probably shouldn't lose it when undecorating.

I spot-checked a few of the funnier-looking outputs, and undname has the same output.

Differential Revision: https://reviews.llvm.org/D54396

llvm-svn: 346791
This commit is contained in:
Nico Weber 2018-11-13 20:18:26 +00:00
parent f22250fb3a
commit 0ad4ee4225
9 changed files with 42 additions and 31 deletions

View File

@ -368,16 +368,23 @@ void LiteralOperatorIdentifierNode::output(OutputStream &OS,
void FunctionSignatureNode::outputPre(OutputStream &OS,
OutputFlags Flags) const {
if (FunctionClass & FC_Public)
OS << "public: ";
if (FunctionClass & FC_Protected)
OS << "protected: ";
if (FunctionClass & FC_Private)
OS << "private: ";
if (!(FunctionClass & FC_Global)) {
if (FunctionClass & FC_Static)
OS << "static ";
}
if (FunctionClass & FC_ExternC)
OS << "extern \"C\" ";
if (FunctionClass & FC_Virtual)
OS << "virtual ";
if (FunctionClass & FC_ExternC)
OS << "extern \"C\" ";
if (ReturnType) {
ReturnType->outputPre(OS, Flags);
OS << " ";
@ -554,9 +561,13 @@ void FunctionSymbolNode::output(OutputStream &OS, OutputFlags Flags) const {
void VariableSymbolNode::output(OutputStream &OS, OutputFlags Flags) const {
switch (SC) {
case StorageClass::PrivateStatic:
OS << "private: static ";
break;
case StorageClass::PublicStatic:
OS << "public: static ";
break;
case StorageClass::ProtectedStatic:
OS << "static ";
OS << "protected: static ";
break;
default:
break;

View File

@ -111,10 +111,10 @@
; CHECK: int __cdecl PR18204::f<union PR18204::<unnamed-type-$S1>>(union PR18204::<unnamed-type-$S1> *)
??R<lambda_0>@?0??PR26105@@YAHXZ@QBE@H@Z
; CHECK: __thiscall `int __cdecl PR26105(void)'::`1'::<lambda_0>::operator()(int) const
; CHECK: public: __thiscall `int __cdecl PR26105(void)'::`1'::<lambda_0>::operator()(int) const
??R<lambda_1>@?0???R<lambda_0>@?0??PR26105@@YAHXZ@QBE@H@Z@QBE@H@Z
; CHECK: __thiscall `__thiscall `int __cdecl PR26105(void)'::`1'::<lambda_0>::operator()(int) const'::`1'::<lambda_1>::operator()(int) const
; CHECK: public: __thiscall `public: __thiscall `int __cdecl PR26105(void)'::`1'::<lambda_0>::operator()(int) const'::`1'::<lambda_1>::operator()(int) const
?unaligned_foo1@@YAPFAHXZ
; CHECK: int __unaligned * __cdecl unaligned_foo1(void)
@ -144,7 +144,7 @@
; CHECK: __thiscall PR31197::A::x::<lambda_1>::operator()(void) const
?white@?1???R<lambda_1>@x@A@PR31197@@QBE@XZ@4HA
; CHECK: int `__thiscall PR31197::A::x::<lambda_1>::operator()(void) const'::`2'::white
; CHECK: int `public: __thiscall PR31197::A::x::<lambda_1>::operator()(void) const'::`2'::white
?f@@YAXW4<unnamed-enum-enumerator>@@@Z
; CHECK: void __cdecl f(enum <unnamed-enum-enumerator>)

View File

@ -16,10 +16,10 @@
; CHECK: <auto> __thiscall <lambda_0>::operator()(void) const
?ValueFromLambdaWithLocalType@@3ULocalType@?1???R<lambda_0>@@QBE?A?<auto>@@XZ@A
; CHECK: struct `<auto> __thiscall <lambda_0>::operator()(void) const'::`2'::LocalType ValueFromLambdaWithLocalType
; CHECK: struct `public: <auto> __thiscall <lambda_0>::operator()(void) const'::`2'::LocalType ValueFromLambdaWithLocalType
?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R<lambda_1>@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z@QBE?A?3@XZ@A
; CHECK: struct `<auto> __thiscall `<auto> __cdecl TemplateFuncionWithLocalLambda<int>(int)'::`1'::<lambda_1>::operator()(void) const'::`3'::LocalType ValueFromTemplateFuncionWithLocalLambda
; CHECK: struct `public: <auto> __thiscall `<auto> __cdecl TemplateFuncionWithLocalLambda<int>(int)'::`1'::<lambda_1>::operator()(void) const'::`3'::LocalType ValueFromTemplateFuncionWithLocalLambda
??$TemplateFuncionWithLocalLambda@H@@YA?A?<auto>@@H@Z
; CHECK: <auto> __cdecl TemplateFuncionWithLocalLambda<int>(int)

View File

@ -81,10 +81,10 @@
; CHECK: int `int __cdecl M(void)'::`2'::M
?L@?2??M@0?2??0@YAHXZ@QEAAHXZ@4HA
; CHECK: int `int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::L
; CHECK: int `public: int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::L
?M@?2??0L@?2??1@YAHXZ@QEAAHXZ@4HA
; CHECK: int `int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::M
; CHECK: int `public: int __cdecl `int __cdecl L(void)'::`3'::L::M(void)'::`3'::M
; Function local scopes of template functions
?M@?1???$L@H@@YAHXZ@4HA
@ -95,16 +95,16 @@
; CHECK: int __cdecl NS::NS<int>::SN(void)
?NS@?1??SN@?$NS@H@0@QEAAHXZ@4HA
; CHECK: int `int __cdecl NS::NS<int>::SN(void)'::`2'::NS
; CHECK: int `public: int __cdecl NS::NS<int>::SN(void)'::`2'::NS
?SN@?1??0?$NS@H@NS@@QEAAHXZ@4HA
; CHECK: int `int __cdecl NS::NS<int>::SN(void)'::`2'::SN
; CHECK: int `public: int __cdecl NS::NS<int>::SN(void)'::`2'::SN
?NS@?1??SN@?$NS@H@10@QEAAHXZ@4HA
; CHECK: int `int __cdecl NS::SN::NS<int>::SN(void)'::`2'::NS
; CHECK: int `public: int __cdecl NS::SN::NS<int>::SN(void)'::`2'::NS
?SN@?1??0?$NS@H@0NS@@QEAAHXZ@4HA
; CHECK: int `int __cdecl NS::SN::NS<int>::SN(void)'::`2'::SN
; CHECK: int `public: int __cdecl NS::SN::NS<int>::SN(void)'::`2'::SN
; Make sure instantiated templates participate in back-referencing.
; In the next 3 examples there should be 3 back-references:
@ -137,10 +137,10 @@
; } } } } }
?C@?1??B@?$C@H@0101A@@QEAAHXZ@4U201013@A
; CHECK: struct A::B::C::B::C::C<int> `int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::C
; CHECK: struct A::B::C::B::C::C<int> `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::C
?B@?1??0?$C@H@C@020A@@QEAAHXZ@4HA
; CHECK: int `int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::B
; CHECK: int `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::B
?A@?1??B@?$C@H@C@1310@QEAAHXZ@4HA
; CHECK: int `int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::A
; CHECK: int `public: int __cdecl A::B::C::B::C::C<int>::B(void)'::`2'::A

View File

@ -162,7 +162,7 @@
; CHECK: virtual void * __cdecl Base::`vector deleting dtor'(unsigned int)
??_EBase@@G3AEPAXI@Z
; CHECK: [thunk]: void * __thiscall Base::`vector deleting dtor'`adjustor{4}'(unsigned int)
; CHECK: [thunk]: private: void * __thiscall Base::`vector deleting dtor'`adjustor{4}'(unsigned int)
??_F?$SomeTemplate@H@@QAEXXZ
; CHECK: void __thiscall SomeTemplate<int>::`default ctor closure'(void)
@ -228,7 +228,7 @@
; CHECK: void __cdecl `dynamic atexit destructor for 'Foo''(void)
??__F_decisionToDFA@XPathLexer@@0V?$vector@VDFA@dfa@antlr4@@V?$allocator@VDFA@dfa@antlr4@@@std@@@std@@A@YAXXZ
; CHECK: void __cdecl `dynamic atexit destructor for `static class std::vector<class antlr4::dfa::DFA, class std::allocator<class antlr4::dfa::DFA>> XPathLexer::_decisionToDFA''(void)
; CHECK: void __cdecl `dynamic atexit destructor for `private: static class std::vector<class antlr4::dfa::DFA, class std::allocator<class antlr4::dfa::DFA>> XPathLexer::_decisionToDFA''(void)
??__K_deg@@YAHO@Z
; CHECK: int __cdecl operator ""_deg(long double)

View File

@ -47,7 +47,7 @@
; CHECK: void __cdecl WrapFnRef<&void __cdecl VoidFn(void)>(void)
??$WrapFnPtr@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ
; CHECK: void __cdecl WrapFnPtr<&static void __cdecl Thing::VoidStaticMethod(void)>(void)
; CHECK: void __cdecl WrapFnPtr<&public: static void __cdecl Thing::VoidStaticMethod(void)>(void)
??$WrapFnRef@$1?VoidStaticMethod@Thing@@SAXXZ@@YAXXZ
; CHECK: void __cdecl WrapFnRef<&static void __cdecl Thing::VoidStaticMethod(void)>(void)
; CHECK: void __cdecl WrapFnRef<&public: static void __cdecl Thing::VoidStaticMethod(void)>(void)

View File

@ -12,7 +12,7 @@
; CHECK: void __cdecl CallMethod<struct M, {[thunk]: __thiscall M::`vcall'{0, {flat}}, 0}>(struct M &)
??$CallMethod@UM@@$H?f@1@QAEXXZA@@@YAXAAUM@@@Z
; CHECK: void __cdecl CallMethod<struct M, {void __thiscall M::f(void), 0}>(struct M &)
; CHECK: void __cdecl CallMethod<struct M, {public: void __thiscall M::f(void), 0}>(struct M &)
??$CallMethod@UO@@$H??_91@$BA@AE3@@YAXAAUO@@@Z
; CHECK: void __cdecl CallMethod<struct O, {[thunk]: __thiscall O::`vcall'{0, {flat}}, 4}>(struct O &)
@ -24,7 +24,7 @@
; CHECK: void __cdecl CallMethod<struct S, &[thunk]: __thiscall S::`vcall'{0, {flat}}>(struct S &)
??$CallMethod@US@@$1?f@1@QAEXXZ@@YAXAAUS@@@Z
; CHECK: void __cdecl CallMethod<struct S, &void __thiscall S::f(void)>(struct S &)
; CHECK: void __cdecl CallMethod<struct S, &public: void __thiscall S::f(void)>(struct S &)
??$CallMethod@UU@@$0A@@@YAXAAUU@@@Z
; CHECK: void __cdecl CallMethod<struct U, 0>(struct U &)
@ -33,7 +33,7 @@
; CHECK: void __cdecl CallMethod<struct U, {[thunk]: __thiscall U::`vcall'{0, {flat}}, 0, 0, 0}>(struct U &)
??$CallMethod@UU@@$J?f@1@QAEXXZA@A@A@@@YAXAAUU@@@Z
; CHECK: void __cdecl CallMethod<struct U, {void __thiscall U::f(void), 0, 0, 0}>(struct U &)
; CHECK: void __cdecl CallMethod<struct U, {public: void __thiscall U::f(void), 0, 0, 0}>(struct U &)
??$CallMethod@UV@@$0A@@@YAXAAUV@@@Z
; CHECK: void __cdecl CallMethod<struct V, 0>(struct V &)
@ -42,7 +42,7 @@
; CHECK: void __cdecl CallMethod<struct V, {[thunk]: __thiscall V::`vcall'{0, {flat}}, 0, 0}>(struct V &)
??$CallMethod@UV@@$I?f@1@QAEXXZA@A@@@YAXAAUV@@@Z
; CHECK: void __cdecl CallMethod<struct V, {void __thiscall V::f(void), 0, 0}>(struct V &)
; CHECK: void __cdecl CallMethod<struct V, {public: void __thiscall V::f(void), 0, 0}>(struct V &)
??$ReadField@UA@@$0?0@@YAHAAUA@@@Z
; CHECK: int __cdecl ReadField<struct A, -1>(struct A &)

View File

@ -195,7 +195,7 @@
; CHECK: void __thiscall UUIDType4<&struct __s_GUID const _GUID_12345678_1234_1234_1234_1234567890ab>::bar(void)
??$f@US@@$1?g@1@QEAAXXZ@@YAXXZ
; CHECK: void __cdecl f<struct S, &void __cdecl S::g(void)>(void)
; CHECK: void __cdecl f<struct S, &public: void __cdecl S::g(void)>(void)
??$?0N@?$Foo@H@@QEAA@N@Z
; CHECK: __cdecl Foo<int>::Foo<int><double>(double)
; CHECK: __cdecl Foo<int>::Foo<int><double>(double)

View File

@ -3,13 +3,13 @@
; CHECK-NOT: Invalid mangled name
?f@C@@WBA@EAAHXZ
; CHECK: [thunk]: virtual int __cdecl C::f`adjustor{16}'(void)
; CHECK: [thunk]: public: virtual int __cdecl C::f`adjustor{16}'(void)
??_EDerived@@$4PPPPPPPM@A@EAAPEAXI@Z
; CHECK: [thunk]: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
; CHECK: [thunk]: public: virtual void * __cdecl Derived::`vector deleting dtor'`vtordisp{-4, 0}'(unsigned int)
?f@A@simple@@$R477PPPPPPPM@7AEXXZ
; CHECK: [thunk]: virtual void __thiscall simple::A::f`vtordispex{8, 8, -4, 8}'(void)
; CHECK: [thunk]: public: virtual void __thiscall simple::A::f`vtordispex{8, 8, -4, 8}'(void)
??_9Base@@$B7AA
; CHECK: [thunk]: __cdecl Base::`vcall'{8, {flat}}