Install thunks later to fixup overrides. Track space taken by vbase
offsets better for thunk refinements. Cleanups. WIP.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81067 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 29b4c8a..3d3efc6 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -39,10 +39,10 @@
: Context(C), Out(os), Structor(0), StructorType(0) { }
bool mangle(const NamedDecl *D);
- void mangleCalloffset(bool Virtual, int64_t nv, int64_t v);
- void mangleThunk(const NamedDecl *ND, bool Virtual, int64_t nv, int64_t v);
- void mangleCovariantThunk(const NamedDecl *ND, bool VirtualThis,
- int64_t nv_t, int64_t v_t, bool VirtualResult,
+ void mangleCalloffset(int64_t nv, int64_t v);
+ void mangleThunk(const NamedDecl *ND, int64_t nv, int64_t v);
+ void mangleCovariantThunk(const NamedDecl *ND,
+ int64_t nv_t, int64_t v_t,
int64_t nv_r, int64_t v_r);
void mangleGuardVariable(const VarDecl *D);
@@ -241,14 +241,13 @@
mangleNestedName(ND);
}
-void CXXNameMangler::mangleCalloffset(bool Virtual, int64_t nv,
- int64_t v) {
+void CXXNameMangler::mangleCalloffset(int64_t nv, int64_t v) {
// <call-offset> ::= h <nv-offset> _
// ::= v <v-offset> _
// <nv-offset> ::= <offset number> # non-virtual base override
// <v-offset> ::= <offset nubmer> _ <virtual offset number>
// # virtual base override, with vcall offset
- if (!Virtual) {
+ if (v == 0) {
Out << "h";
if (nv < 0) {
Out << "n";
@@ -272,26 +271,24 @@
Out << "_";
}
-void CXXNameMangler::mangleThunk(const NamedDecl *D, bool Virtual, int64_t nv,
- int64_t v) {
+void CXXNameMangler::mangleThunk(const NamedDecl *D, int64_t nv, int64_t v) {
// <special-name> ::= T <call-offset> <base encoding>
// # base is the nominal target function of thunk
Out << "_T";
- mangleCalloffset(Virtual, nv, v);
+ mangleCalloffset(nv, v);
mangleName(D);
}
void CXXNameMangler::mangleCovariantThunk(const NamedDecl *D,
- bool VirtualThis, int64_t nv_t,
- int64_t v_t, bool VirtualResult,
+ int64_t nv_t, int64_t v_t,
int64_t nv_r, int64_t v_r) {
// <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
// # base is the nominal target function of thunk
// # first call-offset is 'this' adjustment
// # second call-offset is result adjustment
Out << "_Tc";
- mangleCalloffset(VirtualThis, nv_t, v_t);
- mangleCalloffset(VirtualResult, nv_r, v_r);
+ mangleCalloffset(nv_t, v_t);
+ mangleCalloffset(nv_r, v_r);
mangleName(D);
}
@@ -859,7 +856,7 @@
/// \brief Mangles the a thunk with the offset n for the declaration D and
/// emits that name to the given output stream.
- void mangleThunk(const NamedDecl *D, bool Virtual, int64_t nv, int64_t v,
+ void mangleThunk(const NamedDecl *D, int64_t nv, int64_t v,
ASTContext &Context, llvm::raw_ostream &os) {
// FIXME: Hum, we might have to thunk these, fix.
assert(!isa<CXXConstructorDecl>(D) &&
@@ -868,15 +865,14 @@
"Use mangleCXXDtor for destructor decls!");
CXXNameMangler Mangler(Context, os);
- Mangler.mangleThunk(D, Virtual, nv, v);
+ Mangler.mangleThunk(D, nv, v);
os.flush();
}
/// \brief Mangles the a covariant thunk for the declaration D and emits that
/// name to the given output stream.
- void mangleCovariantThunk(const NamedDecl *D, bool VirtualThis, int64_t nv_t,
- int64_t v_t, bool VirtualResult, int64_t nv_r,
- int64_t v_r, ASTContext &Context,
+ void mangleCovariantThunk(const NamedDecl *D, int64_t nv_t, int64_t v_t,
+ int64_t nv_r, int64_t v_r, ASTContext &Context,
llvm::raw_ostream &os) {
// FIXME: Hum, we might have to thunk these, fix.
assert(!isa<CXXConstructorDecl>(D) &&
@@ -885,8 +881,7 @@
"Use mangleCXXDtor for destructor decls!");
CXXNameMangler Mangler(Context, os);
- Mangler.mangleCovariantThunk(D, VirtualThis, nv_t, v_t, VirtualResult,
- nv_r, v_r);
+ Mangler.mangleCovariantThunk(D, nv_t, v_t, nv_r, v_r);
os.flush();
}