forked from OSchip/llvm-project
parent
a8ee2e7496
commit
3f707e9f14
|
@ -39,7 +39,11 @@ namespace {
|
||||||
: Context(C), Out(os), Structor(0), StructorType(0) { }
|
: Context(C), Out(os), Structor(0), StructorType(0) { }
|
||||||
|
|
||||||
bool mangle(const NamedDecl *D);
|
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 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,
|
||||||
|
int64_t nv_r, int64_t v_r);
|
||||||
void mangleGuardVariable(const VarDecl *D);
|
void mangleGuardVariable(const VarDecl *D);
|
||||||
|
|
||||||
void mangleCXXVtable(QualType Type);
|
void mangleCXXVtable(QualType Type);
|
||||||
|
@ -237,24 +241,22 @@ void CXXNameMangler::mangleName(const NamedDecl *ND) {
|
||||||
mangleNestedName(ND);
|
mangleNestedName(ND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CXXNameMangler::mangleThunk(const NamedDecl *D, bool Virtual, int64_t nv,
|
void CXXNameMangler::mangleCalloffset(bool Virtual, int64_t nv,
|
||||||
int64_t v) {
|
int64_t v) {
|
||||||
// <special-name> ::= T <call-offset> <base encoding>
|
|
||||||
// # base is the nominal target function of thunk
|
|
||||||
// <call-offset> ::= h <nv-offset> _
|
// <call-offset> ::= h <nv-offset> _
|
||||||
// ::= v <v-offset> _
|
// ::= v <v-offset> _
|
||||||
// <nv-offset> ::= <offset number> # non-virtual base override
|
// <nv-offset> ::= <offset number> # non-virtual base override
|
||||||
// <v-offset> ::= <offset nubmer> _ <virtual offset number>
|
// <v-offset> ::= <offset nubmer> _ <virtual offset number>
|
||||||
// # virtual base override, with vcall offset
|
// # virtual base override, with vcall offset
|
||||||
if (!Virtual) {
|
if (!Virtual) {
|
||||||
Out << "_Th";
|
Out << "h";
|
||||||
if (nv < 0) {
|
if (nv < 0) {
|
||||||
Out << "n";
|
Out << "n";
|
||||||
nv = -nv;
|
nv = -nv;
|
||||||
}
|
}
|
||||||
Out << nv;
|
Out << nv;
|
||||||
} else {
|
} else {
|
||||||
Out << "_Tv";
|
Out << "v";
|
||||||
if (nv < 0) {
|
if (nv < 0) {
|
||||||
Out << "n";
|
Out << "n";
|
||||||
nv = -nv;
|
nv = -nv;
|
||||||
|
@ -268,6 +270,28 @@ void CXXNameMangler::mangleThunk(const NamedDecl *D, bool Virtual, int64_t nv,
|
||||||
Out << v;
|
Out << v;
|
||||||
}
|
}
|
||||||
Out << "_";
|
Out << "_";
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXXNameMangler::mangleThunk(const NamedDecl *D, bool Virtual, 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);
|
||||||
|
mangleName(D);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CXXNameMangler::mangleCovariantThunk(const NamedDecl *D,
|
||||||
|
bool VirtualThis, int64_t nv_t,
|
||||||
|
int64_t v_t, bool VirtualResult,
|
||||||
|
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);
|
||||||
mangleName(D);
|
mangleName(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -845,6 +869,24 @@ namespace clang {
|
||||||
os.flush();
|
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,
|
||||||
|
llvm::raw_ostream &os) {
|
||||||
|
// FIXME: Hum, we might have to thunk these, fix.
|
||||||
|
assert(!isa<CXXConstructorDecl>(D) &&
|
||||||
|
"Use mangleCXXCtor for constructor decls!");
|
||||||
|
assert(!isa<CXXDestructorDecl>(D) &&
|
||||||
|
"Use mangleCXXDtor for destructor decls!");
|
||||||
|
|
||||||
|
CXXNameMangler Mangler(Context, os);
|
||||||
|
Mangler.mangleCovariantThunk(D, VirtualThis, nv_t, v_t, VirtualResult,
|
||||||
|
nv_r, v_r);
|
||||||
|
os.flush();
|
||||||
|
}
|
||||||
|
|
||||||
/// mangleGuardVariable - Returns the mangled name for a guard variable
|
/// mangleGuardVariable - Returns the mangled name for a guard variable
|
||||||
/// for the passed in VarDecl.
|
/// for the passed in VarDecl.
|
||||||
void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
|
void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
|
||||||
|
|
|
@ -36,6 +36,10 @@ namespace clang {
|
||||||
llvm::raw_ostream &os);
|
llvm::raw_ostream &os);
|
||||||
void mangleThunk(const NamedDecl *D, bool Virtual, int64_t n, int64_t vn,
|
void mangleThunk(const NamedDecl *D, bool Virtual, int64_t n, int64_t vn,
|
||||||
ASTContext &Context, llvm::raw_ostream &os);
|
ASTContext &Context, llvm::raw_ostream &os);
|
||||||
|
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,
|
||||||
|
llvm::raw_ostream &os);
|
||||||
void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
|
void mangleGuardVariable(const VarDecl *D, ASTContext &Context,
|
||||||
llvm::raw_ostream &os);
|
llvm::raw_ostream &os);
|
||||||
void mangleCXXVtable(QualType T, ASTContext &Context, llvm::raw_ostream &os);
|
void mangleCXXVtable(QualType T, ASTContext &Context, llvm::raw_ostream &os);
|
||||||
|
|
Loading…
Reference in New Issue