diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2013-09-27 14:48:01 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2013-09-27 14:48:01 +0000 |
commit | 8b5987eba5a080962cbc98ce5f006db3aa62ae2e (patch) | |
tree | e0986fcd7045e6a7713a09ebe39936cec8263dde /clang/lib/AST/MicrosoftMangle.cpp | |
parent | f56ddf7fd1ea405e29b603f5afd54b736d8031f3 (diff) | |
download | bcm5719-llvm-8b5987eba5a080962cbc98ce5f006db3aa62ae2e.tar.gz bcm5719-llvm-8b5987eba5a080962cbc98ce5f006db3aa62ae2e.zip |
Abstract out the emission of vtables, add basic support for vtable emission when using -cxx-abi microsoft
Reviewed at http://llvm-reviews.chandlerc.com/D1532
llvm-svn: 191523
Diffstat (limited to 'clang/lib/AST/MicrosoftMangle.cpp')
-rw-r--r-- | clang/lib/AST/MicrosoftMangle.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp index cf68cdd1d5f..211e6e79314 100644 --- a/clang/lib/AST/MicrosoftMangle.cpp +++ b/clang/lib/AST/MicrosoftMangle.cpp @@ -188,6 +188,9 @@ public: raw_ostream &); virtual void mangleCXXVTable(const CXXRecordDecl *RD, raw_ostream &); + virtual void mangleCXXVFTable(const CXXRecordDecl *Derived, + ArrayRef<const CXXRecordDecl *> BasePath, + raw_ostream &Out); virtual void mangleCXXVTT(const CXXRecordDecl *RD, raw_ostream &); virtual void mangleCXXVBTable(const CXXRecordDecl *Derived, @@ -1900,16 +1903,26 @@ void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD, void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD, raw_ostream &Out) { + llvm_unreachable( + "The Microsoft C++ ABI does not have vtables (use vftables instead)!"); +} + +void MicrosoftMangleContext::mangleCXXVFTable( + const CXXRecordDecl *Derived, ArrayRef<const CXXRecordDecl *> BasePath, + raw_ostream &Out) { // <mangled-name> ::= ?_7 <class-name> <storage-class> // <cvr-qualifiers> [<name>] @ // NOTE: <cvr-qualifiers> here is always 'B' (const). <storage-class> // is always '6' for vftables. MicrosoftCXXNameMangler Mangler(*this, Out); Mangler.getStream() << "\01??_7"; - Mangler.mangleName(RD); - Mangler.getStream() << "6B"; // '6' for vftable, 'B' for const. - // TODO: If the class has more than one vtable, mangle in the class it came - // from. + Mangler.mangleName(Derived); + Mangler.getStream() << "6B"; // '6' for vftable, 'B' for const. + for (ArrayRef<const CXXRecordDecl *>::iterator I = BasePath.begin(), + E = BasePath.end(); + I != E; ++I) { + Mangler.mangleName(*I); + } Mangler.getStream() << '@'; } |