diff options
author | Anders Carlsson <andersca@mac.com> | 2009-11-26 02:49:32 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-11-26 02:49:32 +0000 |
commit | b73a5be8a85f1823c6e63f85dafaca413d6de40c (patch) | |
tree | ca570a94c2124d7ea922fcb12eb80f77d30d88a2 /lib/CodeGen/Mangle.cpp | |
parent | 38cc6bca5c172e2888c86fb0bef6883db0692cf6 (diff) |
Move the mangler into the CodeGen namespace. Change mangleThunk to take a ThunkAdjustment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.cpp')
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index e2ae86bd45..37061f144c 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -26,7 +26,9 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/ErrorHandling.h" +#include "CGVtable.h" using namespace clang; +using namespace CodeGen; namespace { @@ -67,8 +69,7 @@ public: llvm::raw_svector_ostream &getStream() { return Out; } void mangle(const NamedDecl *D, llvm::StringRef Prefix = "_Z"); - void mangleCallOffset(int64_t NonVirtualOffset, - int64_t VirtualOffset); + void mangleCallOffset(const ThunkAdjustment &Adjustment); void mangleNumber(int64_t Number); void mangleFunctionEncoding(const FunctionDecl *FD); void mangleName(const NamedDecl *ND); @@ -348,24 +349,23 @@ void CXXNameMangler::mangleNumber(int64_t Number) { Out << Number; } -void CXXNameMangler::mangleCallOffset(int64_t NonVirtualOffset, - int64_t VirtualOffset) { +void CXXNameMangler::mangleCallOffset(const ThunkAdjustment &Adjustment) { // <call-offset> ::= h <nv-offset> _ // ::= v <v-offset> _ // <nv-offset> ::= <offset number> # non-virtual base override // <v-offset> ::= <offset number> _ <virtual offset number> // # virtual base override, with vcall offset - if (!VirtualOffset) { + if (!Adjustment.Virtual) { Out << 'h'; - mangleNumber(NonVirtualOffset); + mangleNumber(Adjustment.NonVirtual); Out << '_'; return; } Out << 'v'; - mangleNumber(NonVirtualOffset); + mangleNumber(Adjustment.NonVirtual); Out << '_'; - mangleNumber(VirtualOffset); + mangleNumber(Adjustment.Virtual); Out << '_'; } @@ -1355,8 +1355,7 @@ void MangleContext::mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, /// \brief Mangles the a thunk with the offset n for the declaration D and /// emits that name to the given output stream. void MangleContext::mangleThunk(const FunctionDecl *FD, - int64_t NonVirtualOffset, - int64_t VirtualOffset, + const ThunkAdjustment &ThisAdjustment, llvm::SmallVectorImpl<char> &Res) { // FIXME: Hum, we might have to thunk these, fix. assert(!isa<CXXDestructorDecl>(FD) && @@ -1366,7 +1365,7 @@ void MangleContext::mangleThunk(const FunctionDecl *FD, // # base is the nominal target function of thunk CXXNameMangler Mangler(*this, Res); Mangler.getStream() << "_ZT"; - Mangler.mangleCallOffset(NonVirtualOffset, VirtualOffset); + Mangler.mangleCallOffset(ThisAdjustment); Mangler.mangleFunctionEncoding(FD); } @@ -1385,8 +1384,8 @@ void MangleContext::mangleCovariantThunk(const FunctionDecl *FD, int64_t nv_t, // # second call-offset is result adjustment CXXNameMangler Mangler(*this, Res); Mangler.getStream() << "_ZTc"; - Mangler.mangleCallOffset(nv_t, v_t); - Mangler.mangleCallOffset(nv_r, v_r); + Mangler.mangleCallOffset(ThunkAdjustment(nv_t, v_t)); + Mangler.mangleCallOffset(ThunkAdjustment(nv_r, v_r)); Mangler.mangleFunctionEncoding(FD); } |