diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-09-10 20:43:12 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-09-10 20:43:12 +0000 |
commit | 1ece9fc80677745278bbe670c595215b1748c951 (patch) | |
tree | af60f15c71debdd36a38f60c6d77cf79cb5671c0 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | 24ffd63626708237ad9b30d6aa237ae5d0c86c8b (diff) | |
download | bcm5719-llvm-1ece9fc80677745278bbe670c595215b1748c951.tar.gz bcm5719-llvm-1ece9fc80677745278bbe670c595215b1748c951.zip |
[ms-cxxabi] Mangle dynamic initializer stubs the same way MSVC does
Summary: Dynamic initializers are mangled as ??__E <name> YAXXZ.
Reviewers: timurrrr
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1477
llvm-svn: 190434
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index 7e3d6c21395..3ccc2bddf6d 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -170,8 +170,12 @@ public: raw_ostream &); virtual void mangleReferenceTemporary(const VarDecl *, raw_ostream &); virtual void mangleStaticGuardVariable(const VarDecl *D, raw_ostream &Out); + virtual void mangleDynamicInitializer(const VarDecl *D, raw_ostream &Out); virtual void mangleDynamicAtExitDestructor(const VarDecl *D, raw_ostream &Out); + +private: + void mangleInitFiniStub(const VarDecl *D, raw_ostream &Out, char CharCode); }; } @@ -1941,17 +1945,29 @@ void MicrosoftMangleContext::mangleStaticGuardVariable(const VarDecl *VD, Mangler.getStream() << (Visible ? "@51" : "@4IA"); } -void MicrosoftMangleContext::mangleDynamicAtExitDestructor(const VarDecl *D, - raw_ostream &Out) { - // <destructor-name> ::= ?__F <postfix> YAXXZ +void MicrosoftMangleContext::mangleInitFiniStub(const VarDecl *D, + raw_ostream &Out, + char CharCode) { MicrosoftCXXNameMangler Mangler(*this, Out); - Mangler.getStream() << "\01??__F"; + Mangler.getStream() << "\01??__" << CharCode; Mangler.mangleName(D); - // This is the mangling of the function type of the stub, which is a global, - // non-variadic, cdecl function that returns void and takes no args. + // This is the function class mangling. These stubs are global, non-variadic, + // cdecl functions that return void and take no args. Mangler.getStream() << "YAXXZ"; } +void MicrosoftMangleContext::mangleDynamicInitializer(const VarDecl *D, + raw_ostream &Out) { + // <initializer-name> ::= ?__E <name> YAXXZ + mangleInitFiniStub(D, Out, 'E'); +} + +void MicrosoftMangleContext::mangleDynamicAtExitDestructor(const VarDecl *D, + raw_ostream &Out) { + // <destructor-name> ::= ?__F <name> YAXXZ + mangleInitFiniStub(D, Out, 'F'); +} + MangleContext *clang::createMicrosoftMangleContext(ASTContext &Context, DiagnosticsEngine &Diags) { return new MicrosoftMangleContext(Context, Diags); |