r208668 - MS ABI: Tighten RTTI mangling
David Majnemer
david.majnemer at gmail.com
Mon May 12 23:57:43 PDT 2014
Author: majnemer
Date: Tue May 13 01:57:43 2014
New Revision: 208668
URL: http://llvm.org/viewvc/llvm-project?rev=208668&view=rev
Log:
MS ABI: Tighten RTTI mangling
r208661 contained WIP code, commit the *actual* manglings.
Modified:
cfe/trunk/include/clang/AST/Mangle.h
cfe/trunk/lib/AST/MicrosoftMangle.cpp
Modified: cfe/trunk/include/clang/AST/Mangle.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Mangle.h?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Mangle.h (original)
+++ cfe/trunk/include/clang/AST/Mangle.h Tue May 13 01:57:43 2014
@@ -214,9 +214,8 @@ public:
raw_ostream &) = 0;
virtual void mangleCXXRTTIBaseClassDescriptor(
- const CXXRecordDecl *Derived, ArrayRef<const CXXRecordDecl *> BasePath,
- uint32_t NVOffset, uint32_t VBPtrOffset, uint32_t VBTableOffset,
- uint32_t Flags, raw_ostream &Out) = 0;
+ const CXXRecordDecl *Derived, uint32_t NVOffset, uint32_t VBPtrOffset,
+ uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0;
virtual void mangleCXXRTTIBaseClassArray(const CXXRecordDecl *Derived,
raw_ostream &Out) = 0;
@@ -224,11 +223,10 @@ public:
mangleCXXRTTIClassHierarchyDescriptor(const CXXRecordDecl *Derived,
raw_ostream &Out) = 0;
- virtual void mangleCXXRTTICompleteObjectLocator(const CXXRecordDecl *Derived,
- uint32_t OffsetFromTop,
- uint32_t VFPtrToVtordispDelta,
- uint32_t Flags,
- raw_ostream &Out) = 0;
+ virtual void
+ mangleCXXRTTICompleteObjectLocator(const CXXRecordDecl *Derived,
+ ArrayRef<const CXXRecordDecl *> BasePath,
+ raw_ostream &Out) = 0;
static bool classof(const MangleContext *C) {
return C->getKind() == MK_Microsoft;
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=208668&r1=208667&r2=208668&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue May 13 01:57:43 2014
@@ -112,19 +112,18 @@ public:
raw_ostream &Out) override;
void mangleCXXRTTI(QualType T, raw_ostream &Out) override;
void mangleCXXRTTIName(QualType T, raw_ostream &Out) override;
- void mangleCXXRTTIBaseClassDescriptor(
- const CXXRecordDecl *Derived, ArrayRef<const CXXRecordDecl *> BasePath,
- uint32_t NVOffset, uint32_t VBPtrOffset, uint32_t VBTableOffset,
- uint32_t Flags, raw_ostream &Out) override;
+ void mangleCXXRTTIBaseClassDescriptor(const CXXRecordDecl *Derived,
+ uint32_t NVOffset, uint32_t VBPtrOffset,
+ uint32_t VBTableOffset, uint32_t Flags,
+ raw_ostream &Out) override;
void mangleCXXRTTIBaseClassArray(const CXXRecordDecl *Derived,
raw_ostream &Out) override;
void mangleCXXRTTIClassHierarchyDescriptor(const CXXRecordDecl *Derived,
raw_ostream &Out) override;
- void mangleCXXRTTICompleteObjectLocator(const CXXRecordDecl *Derived,
- uint32_t OffsetFromTop,
- uint32_t VFPtrToVtordispDelta,
- uint32_t Flags,
- raw_ostream &Out) override;
+ void
+ mangleCXXRTTICompleteObjectLocator(const CXXRecordDecl *Derived,
+ ArrayRef<const CXXRecordDecl *> BasePath,
+ raw_ostream &Out) override;
void mangleTypeName(QualType T, raw_ostream &) override;
void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
raw_ostream &) override;
@@ -2259,18 +2258,15 @@ void MicrosoftMangleContextImpl::mangleC
}
void MicrosoftMangleContextImpl::mangleCXXRTTIBaseClassDescriptor(
- const CXXRecordDecl *Derived, ArrayRef<const CXXRecordDecl *> BasePath,
- uint32_t NVOffset, uint32_t VBPtrOffset, uint32_t VBTableOffset,
- uint32_t Flags, raw_ostream &Out) {
+ const CXXRecordDecl *Derived, uint32_t NVOffset, uint32_t VBPtrOffset,
+ uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) {
MicrosoftCXXNameMangler Mangler(*this, Out);
Mangler.getStream() << "\01??_R1";
- Mangler.mangleName(Derived);
- for (const CXXRecordDecl *RD : BasePath)
- Mangler.mangleName(RD);
Mangler.mangleNumber(NVOffset);
Mangler.mangleNumber(VBPtrOffset);
Mangler.mangleNumber(VBTableOffset);
Mangler.mangleNumber(Flags);
+ Mangler.mangleName(Derived);
Mangler.getStream() << "@8";
}
@@ -2291,15 +2287,19 @@ void MicrosoftMangleContextImpl::mangleC
}
void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
- const CXXRecordDecl *Derived, uint32_t OffsetFromTop,
- uint32_t VFPtrToVtordispDelta, uint32_t Flags, raw_ostream &Out) {
+ const CXXRecordDecl *Derived, ArrayRef<const CXXRecordDecl *> BasePath,
+ raw_ostream &Out) {
+ // <mangled-name> ::= ?_R4 <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??_R4";
Mangler.mangleName(Derived);
- Mangler.mangleNumber(Flags);
- Mangler.mangleNumber(OffsetFromTop);
- Mangler.mangleNumber(VFPtrToVtordispDelta);
- Mangler.getStream() << "@8";
+ Mangler.getStream() << "6B"; // '6' for vftable, 'B' for const.
+ for (const CXXRecordDecl *RD : BasePath)
+ Mangler.mangleName(RD);
+ Mangler.getStream() << '@';
}
void MicrosoftMangleContextImpl::mangleTypeName(QualType T, raw_ostream &Out) {
More information about the cfe-commits
mailing list