From 37e4c41283aae2160ea6f7d33030d19a07af7d7e Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Thu, 3 Dec 2009 00:03:05 +0000 Subject: Work-in-progress: teach mangler how to mangle thunks for destructors. llvm-svn: 90360 --- clang/lib/CodeGen/Mangle.cpp | 16 +++++++++++++--- clang/lib/CodeGen/Mangle.h | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen') diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp index 2a11ee227dd..d70d2567cfc 100644 --- a/clang/lib/CodeGen/Mangle.cpp +++ b/clang/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 &Res) { - // FIXME: Hum, we might have to thunk these, fix. assert(!isa(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 &Res) { + // ::= T + // # 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 &Res) { - // FIXME: Hum, we might have to thunk these, fix. assert(!isa(FD) && - "Use mangleCXXDtor for destructor decls!"); + "No such thing as a covariant thunk for a destructor!"); // ::= Tc // # base is the nominal target function of thunk diff --git a/clang/lib/CodeGen/Mangle.h b/clang/lib/CodeGen/Mangle.h index a1d6661f9e2..8d9629528d6 100644 --- a/clang/lib/CodeGen/Mangle.h +++ b/clang/lib/CodeGen/Mangle.h @@ -67,6 +67,9 @@ public: void mangleThunk(const FunctionDecl *FD, const ThunkAdjustment &ThisAdjustment, llvm::SmallVectorImpl &); + void mangleCXXDtorThunk(const CXXDestructorDecl *D, CXXDtorType Type, + const ThunkAdjustment &ThisAdjustment, + llvm::SmallVectorImpl &); void mangleCovariantThunk(const FunctionDecl *FD, const CovariantThunkAdjustment& Adjustment, llvm::SmallVectorImpl &); -- cgit v1.2.3