[cfe-commits] r90360 - in /cfe/trunk/lib/CodeGen: Mangle.cpp Mangle.h

Eli Friedman eli.friedman at gmail.com
Wed Dec 2 16:03:05 PST 2009


Author: efriedma
Date: Wed Dec  2 18:03:05 2009
New Revision: 90360

URL: http://llvm.org/viewvc/llvm-project?rev=90360&view=rev
Log:
Work-in-progress: teach mangler how to mangle thunks for destructors.


Modified:
    cfe/trunk/lib/CodeGen/Mangle.cpp
    cfe/trunk/lib/CodeGen/Mangle.h

Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=90360&r1=90359&r2=90360&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Dec  2 18:03:05 2009
@@ -1376,7 +1376,6 @@
 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 @@
   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

Modified: cfe/trunk/lib/CodeGen/Mangle.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.h?rev=90360&r1=90359&r2=90360&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.h (original)
+++ cfe/trunk/lib/CodeGen/Mangle.h Wed Dec  2 18:03:05 2009
@@ -67,6 +67,9 @@
   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> &);





More information about the cfe-commits mailing list