#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 {
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);
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 << '_';
}
/// \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) &&
// # 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);
}
// # 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);
}
#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 {
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,
/// @}
};
+
+}
}
#endif