Index: lib/Demangle/MicrosoftDemangleNodes.cpp =================================================================== --- lib/Demangle/MicrosoftDemangleNodes.cpp +++ lib/Demangle/MicrosoftDemangleNodes.cpp @@ -368,16 +368,23 @@ 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 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; Index: test/Demangle/ms-cxx11.test =================================================================== --- test/Demangle/ms-cxx11.test +++ test/Demangle/ms-cxx11.test @@ -111,10 +111,10 @@ ; CHECK: int __cdecl PR18204::f>(union PR18204:: *) ??R@?0??PR26105@@YAHXZ@QBE@H@Z -; CHECK: __thiscall `int __cdecl PR26105(void)'::`1'::::operator()(int) const +; CHECK: public: __thiscall `int __cdecl PR26105(void)'::`1'::::operator()(int) const ??R@?0???R@?0??PR26105@@YAHXZ@QBE@H@Z@QBE@H@Z -; CHECK: __thiscall `__thiscall `int __cdecl PR26105(void)'::`1'::::operator()(int) const'::`1'::::operator()(int) const +; CHECK: public: __thiscall `public: __thiscall `int __cdecl PR26105(void)'::`1'::::operator()(int) const'::`1'::::operator()(int) const ?unaligned_foo1@@YAPFAHXZ ; CHECK: int __unaligned * __cdecl unaligned_foo1(void) @@ -144,7 +144,7 @@ ; CHECK: __thiscall PR31197::A::x::::operator()(void) const ?white@?1???R@x@A@PR31197@@QBE@XZ@4HA -; CHECK: int `__thiscall PR31197::A::x::::operator()(void) const'::`2'::white +; CHECK: int `public: __thiscall PR31197::A::x::::operator()(void) const'::`2'::white ?f@@YAXW4@@@Z ; CHECK: void __cdecl f(enum ) Index: test/Demangle/ms-cxx14.test =================================================================== --- test/Demangle/ms-cxx14.test +++ test/Demangle/ms-cxx14.test @@ -16,10 +16,10 @@ ; CHECK: __thiscall ::operator()(void) const ?ValueFromLambdaWithLocalType@@3ULocalType@?1???R@@QBE?A?@@XZ@A -; CHECK: struct ` __thiscall ::operator()(void) const'::`2'::LocalType ValueFromLambdaWithLocalType +; CHECK: struct `public: __thiscall ::operator()(void) const'::`2'::LocalType ValueFromLambdaWithLocalType ?ValueFromTemplateFuncionWithLocalLambda@@3ULocalType@?2???R@?0???$TemplateFuncionWithLocalLambda@H@@YA?A?@@H@Z@QBE?A?3@XZ@A -; CHECK: struct ` __thiscall ` __cdecl TemplateFuncionWithLocalLambda(int)'::`1'::::operator()(void) const'::`3'::LocalType ValueFromTemplateFuncionWithLocalLambda +; CHECK: struct `public: __thiscall ` __cdecl TemplateFuncionWithLocalLambda(int)'::`1'::::operator()(void) const'::`3'::LocalType ValueFromTemplateFuncionWithLocalLambda ??$TemplateFuncionWithLocalLambda@H@@YA?A?@@H@Z ; CHECK: __cdecl TemplateFuncionWithLocalLambda(int) Index: test/Demangle/ms-nested-scopes.test =================================================================== --- test/Demangle/ms-nested-scopes.test +++ test/Demangle/ms-nested-scopes.test @@ -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::SN(void) ?NS@?1??SN@?$NS@H@0@QEAAHXZ@4HA -; CHECK: int `int __cdecl NS::NS::SN(void)'::`2'::NS +; CHECK: int `public: int __cdecl NS::NS::SN(void)'::`2'::NS ?SN@?1??0?$NS@H@NS@@QEAAHXZ@4HA -; CHECK: int `int __cdecl NS::NS::SN(void)'::`2'::SN +; CHECK: int `public: int __cdecl NS::NS::SN(void)'::`2'::SN ?NS@?1??SN@?$NS@H@10@QEAAHXZ@4HA -; CHECK: int `int __cdecl NS::SN::NS::SN(void)'::`2'::NS +; CHECK: int `public: int __cdecl NS::SN::NS::SN(void)'::`2'::NS ?SN@?1??0?$NS@H@0NS@@QEAAHXZ@4HA -; CHECK: int `int __cdecl NS::SN::NS::SN(void)'::`2'::SN +; CHECK: int `public: int __cdecl NS::SN::NS::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 __cdecl A::B::C::B::C::C::B(void)'::`2'::C +; CHECK: struct A::B::C::B::C::C `public: int __cdecl A::B::C::B::C::C::B(void)'::`2'::C ?B@?1??0?$C@H@C@020A@@QEAAHXZ@4HA -; CHECK: int `int __cdecl A::B::C::B::C::C::B(void)'::`2'::B +; CHECK: int `public: int __cdecl A::B::C::B::C::C::B(void)'::`2'::B ?A@?1??B@?$C@H@C@1310@QEAAHXZ@4HA -; CHECK: int `int __cdecl A::B::C::B::C::C::B(void)'::`2'::A +; CHECK: int `public: int __cdecl A::B::C::B::C::C::B(void)'::`2'::A Index: test/Demangle/ms-operators.test =================================================================== --- test/Demangle/ms-operators.test +++ test/Demangle/ms-operators.test @@ -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::`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> XPathLexer::_decisionToDFA''(void) +; CHECK: void __cdecl `dynamic atexit destructor for `private: static class std::vector> XPathLexer::_decisionToDFA''(void) ??__K_deg@@YAHO@Z ; CHECK: int __cdecl operator ""_deg(long double) Index: test/Demangle/ms-template-callback.test =================================================================== --- test/Demangle/ms-template-callback.test +++ test/Demangle/ms-template-callback.test @@ -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) Index: test/Demangle/ms-templates-memptrs.test =================================================================== --- test/Demangle/ms-templates-memptrs.test +++ test/Demangle/ms-templates-memptrs.test @@ -12,7 +12,7 @@ ; CHECK: void __cdecl CallMethod(struct M &) ??$CallMethod@UM@@$H?f@1@QAEXXZA@@@YAXAAUM@@@Z -; CHECK: void __cdecl CallMethod(struct M &) +; CHECK: void __cdecl CallMethod(struct M &) ??$CallMethod@UO@@$H??_91@$BA@AE3@@YAXAAUO@@@Z ; CHECK: void __cdecl CallMethod(struct O &) @@ -24,7 +24,7 @@ ; CHECK: void __cdecl CallMethod(struct S &) ??$CallMethod@US@@$1?f@1@QAEXXZ@@YAXAAUS@@@Z -; CHECK: void __cdecl CallMethod(struct S &) +; CHECK: void __cdecl CallMethod(struct S &) ??$CallMethod@UU@@$0A@@@YAXAAUU@@@Z ; CHECK: void __cdecl CallMethod(struct U &) @@ -33,7 +33,7 @@ ; CHECK: void __cdecl CallMethod(struct U &) ??$CallMethod@UU@@$J?f@1@QAEXXZA@A@A@@@YAXAAUU@@@Z -; CHECK: void __cdecl CallMethod(struct U &) +; CHECK: void __cdecl CallMethod(struct U &) ??$CallMethod@UV@@$0A@@@YAXAAUV@@@Z ; CHECK: void __cdecl CallMethod(struct V &) @@ -42,7 +42,7 @@ ; CHECK: void __cdecl CallMethod(struct V &) ??$CallMethod@UV@@$I?f@1@QAEXXZA@A@@@YAXAAUV@@@Z -; CHECK: void __cdecl CallMethod(struct V &) +; CHECK: void __cdecl CallMethod(struct V &) ??$ReadField@UA@@$0?0@@YAHAAUA@@@Z ; CHECK: int __cdecl ReadField(struct A &) Index: test/Demangle/ms-templates.test =================================================================== --- test/Demangle/ms-templates.test +++ test/Demangle/ms-templates.test @@ -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(void) +; CHECK: void __cdecl f(void) ??$?0N@?$Foo@H@@QEAA@N@Z -; CHECK: __cdecl Foo::Foo(double) \ No newline at end of file +; CHECK: __cdecl Foo::Foo(double) Index: test/Demangle/ms-thunks.test =================================================================== --- test/Demangle/ms-thunks.test +++ test/Demangle/ms-thunks.test @@ -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}}