aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-12-03 00:03:05 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-12-03 00:03:05 +0000
commit61d89b61d4f22a226139c36a88b4fe2f7a2e368f (patch)
tree0e511857d225e0986e926a61e36cee9d1a0d7ca3
parent25a9c37fc2f91304b36ae774aa93220ccce68d95 (diff)
Work-in-progress: teach mangler how to mangle thunks for destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90360 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/Mangle.cpp16
-rw-r--r--lib/CodeGen/Mangle.h3
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 2a11ee227d..d70d2567cf 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -1376,7 +1376,6 @@ void MangleContext::mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
void MangleContext::mangleThunk(const FunctionDecl *FD,
const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &Res) {
- // FIXME: Hum, we might have to thunk these, fix.
assert(!isa<CXXDestructorDecl>(FD) &&
"Use mangleCXXDtor for destructor decls!");
@@ -1388,15 +1387,26 @@ void MangleContext::mangleThunk(const FunctionDecl *FD,
Mangler.mangleFunctionEncoding(FD);
}
+void MangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *D,
+ CXXDtorType Type,
+ const ThunkAdjustment &ThisAdjustment,
+ llvm::SmallVectorImpl<char> &Res) {
+ // <special-name> ::= T <call-offset> <base encoding>
+ // # base is the nominal target function of thunk
+ CXXNameMangler Mangler(*this, Res, D, Type);
+ Mangler.getStream() << "_ZT";
+ Mangler.mangleCallOffset(ThisAdjustment);
+ Mangler.mangleFunctionEncoding(D);
+}
+
/// \brief Mangles the a covariant thunk for the declaration D and emits that
/// name to the given output stream.
void
MangleContext::mangleCovariantThunk(const FunctionDecl *FD,
const CovariantThunkAdjustment& Adjustment,
llvm::SmallVectorImpl<char> &Res) {
- // FIXME: Hum, we might have to thunk these, fix.
assert(!isa<CXXDestructorDecl>(FD) &&
- "Use mangleCXXDtor for destructor decls!");
+ "No such thing as a covariant thunk for a destructor!");
// <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
// # base is the nominal target function of thunk
diff --git a/lib/CodeGen/Mangle.h b/lib/CodeGen/Mangle.h
index a1d6661f9e..8d9629528d 100644
--- a/lib/CodeGen/Mangle.h
+++ b/lib/CodeGen/Mangle.h
@@ -67,6 +67,9 @@ public:
void mangleThunk(const FunctionDecl *FD,
const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &);
+ void mangleCXXDtorThunk(const CXXDestructorDecl *D, CXXDtorType Type,
+ const ThunkAdjustment &ThisAdjustment,
+ llvm::SmallVectorImpl<char> &);
void mangleCovariantThunk(const FunctionDecl *FD,
const CovariantThunkAdjustment& Adjustment,
llvm::SmallVectorImpl<char> &);