[cfe-commits] r89930 - in /cfe/trunk/lib/CodeGen: CGCXX.cpp CGVtable.h Mangle.cpp Mangle.h
Anders Carlsson
andersca at mac.com
Wed Nov 25 18:49:32 PST 2009
Author: andersca
Date: Wed Nov 25 20:49:32 2009
New Revision: 89930
URL: http://llvm.org/viewvc/llvm-project?rev=89930&view=rev
Log:
Move the mangler into the CodeGen namespace. Change mangleThunk to take a ThunkAdjustment.
Modified:
cfe/trunk/lib/CodeGen/CGCXX.cpp
cfe/trunk/lib/CodeGen/CGVtable.h
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/lib/CodeGen/Mangle.h
Modified: cfe/trunk/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXX.cpp?rev=89930&r1=89929&r2=89930&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCXX.cpp Wed Nov 25 20:49:32 2009
@@ -968,8 +968,7 @@
const ThunkAdjustment &ThisAdjustment) {
llvm::SmallString<256> OutName;
- getMangleContext().mangleThunk(MD, ThisAdjustment.NonVirtual,
- ThisAdjustment.Virtual, OutName);
+ getMangleContext().mangleThunk(MD, ThisAdjustment, OutName);
llvm::GlobalVariable::LinkageTypes linktype;
linktype = llvm::GlobalValue::WeakAnyLinkage;
Modified: cfe/trunk/lib/CodeGen/CGVtable.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.h?rev=89930&r1=89929&r2=89930&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.h (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.h Wed Nov 25 20:49:32 2009
@@ -17,6 +17,10 @@
#include "llvm/ADT/DenseMap.h"
#include "GlobalDecl.h"
+namespace llvm {
+ class Constant;
+}
+
namespace clang {
class CXXMethodDecl;
class CXXRecordDecl;
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=89930&r1=89929&r2=89930&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Wed Nov 25 20:49:32 2009
@@ -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 @@
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 @@
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 @@
/// \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 @@
// # 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 @@
// # 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);
}
Modified: cfe/trunk/lib/CodeGen/Mangle.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.h?rev=89930&r1=89929&r2=89930&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.h (original)
+++ cfe/trunk/lib/CodeGen/Mangle.h Wed Nov 25 20:49:32 2009
@@ -23,18 +23,20 @@
#include "llvm/ADT/DenseMap.h"
namespace llvm {
-template<typename T>
-class SmallVectorImpl;
+ template<typename T> class SmallVectorImpl;
}
namespace clang {
-class ASTContext;
-class CXXConstructorDecl;
-class CXXDestructorDecl;
-class FunctionDecl;
-class NamedDecl;
-class VarDecl;
-
+ class ASTContext;
+ class CXXConstructorDecl;
+ class CXXDestructorDecl;
+ class FunctionDecl;
+ class NamedDecl;
+ class VarDecl;
+
+namespace CodeGen {
+ class ThunkAdjustment;
+
/// MangleContext - Context for tracking state which persists across multiple
/// calls to the C++ name mangler.
class MangleContext {
@@ -62,7 +64,7 @@
void mangleName(const NamedDecl *D, llvm::SmallVectorImpl<char> &);
void mangleThunk(const FunctionDecl *FD,
- int64_t NonVirtualOffset, int64_t VirtualOffset,
+ const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &);
void mangleCovariantThunk(const FunctionDecl *FD, int64_t nv_t, int64_t v_t,
int64_t nv_r, int64_t v_r,
@@ -82,6 +84,8 @@
/// @}
};
+
+}
}
#endif
More information about the cfe-commits
mailing list