diff options
author | Zachary Turner <zturner@google.com> | 2018-08-30 20:53:11 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2018-08-30 20:53:11 +0000 |
commit | f4f767d534b819348d02048ae7610453004d5d84 (patch) | |
tree | ae5582a4a45d3df88fbebb2298f4ab27ed48b3c3 /clang/lib/AST/MicrosoftMangle.cpp | |
parent | 2499aeead93a28cff56816c6ce7c093d227a0084 (diff) | |
download | bcm5719-llvm-f4f767d534b819348d02048ae7610453004d5d84.tar.gz bcm5719-llvm-f4f767d534b819348d02048ae7610453004d5d84.zip |
[MS ABI] Fix mangling issue with dynamic initializer stubs.
There are two types of dynamic initializer stubs. There's
`dynamic initializer for 'x''(void)
and
`dynamic initializer for `static Foo::Bar StaticDataMember''(void)
The second case is disambiguated from the first by the presence of
a ? after the operator code. So the first will appear something like
?__E<name> while the second will appear something like ?__E?<name>.
clang-cl was mangling these both the same though. This patch
matches behavior with cl.
Differential Revision: https://reviews.llvm.org/D51500
llvm-svn: 341117
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index d5332ba7db5..348f05d3682 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -3217,10 +3217,13 @@ void MicrosoftMangleContextImpl::mangleInitFiniStub(const VarDecl *D, msvc_hashing_ostream MHO(Out); MicrosoftCXXNameMangler Mangler(*this, MHO); Mangler.getStream() << "??__" << CharCode; - Mangler.mangleName(D); if (D->isStaticDataMember()) { + Mangler.getStream() << '?'; + Mangler.mangleName(D); Mangler.mangleVariableEncoding(D); - Mangler.getStream() << '@'; + Mangler.getStream() << "@@"; + } else { + Mangler.mangleName(D); } // This is the function class mangling. These stubs are global, non-variadic, // cdecl functions that return void and take no args. |