Add code to setup the vtable pointer in the constructor. Work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77699 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 9e38904..36ee2a4 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -41,6 +41,7 @@
bool mangle(const NamedDecl *D);
void mangleGuardVariable(const VarDecl *D);
+ void mangleCXXVtable(QualType Type);
void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type);
void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type);
@@ -158,10 +159,16 @@
mangle(D);
}
+void CXXNameMangler::mangleCXXVtable(QualType T) {
+ // <special-name> ::= TV <type> # virtual table
+ Out << "_ZTV";
+ mangleType(T);
+}
+
void CXXNameMangler::mangleGuardVariable(const VarDecl *D)
{
// <special-name> ::= GV <object name> # Guard variable for one-time
- // # initialization
+ // # initialization
Out << "_ZGV";
mangleName(D);
@@ -807,7 +814,12 @@
os.flush();
}
-
-
-}
+ void mangleCXXVtable(QualType Type, ASTContext &Context,
+ llvm::raw_ostream &os) {
+ CXXNameMangler Mangler(Context, os);
+ Mangler.mangleCXXVtable(Type);
+
+ os.flush();
+ }
+}