2009-02-19 02:53:56 +03:00
|
|
|
//===--- Mangle.h - Mangle C++ Names ----------------------------*- C++ -*-===//
|
2009-02-13 03:10:09 +03:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Implements C++ name mangling according to the Itanium C++ ABI,
|
|
|
|
// which is used in GCC 3.2 and newer (and many compilers that are
|
|
|
|
// ABI-compatible with GCC):
|
|
|
|
//
|
|
|
|
// http://www.codesourcery.com/public/cxx-abi/abi.html
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2009-03-21 11:24:40 +03:00
|
|
|
|
2009-02-13 03:10:09 +03:00
|
|
|
#ifndef LLVM_CLANG_CODEGEN_MANGLE_H
|
|
|
|
#define LLVM_CLANG_CODEGEN_MANGLE_H
|
|
|
|
|
2009-04-15 09:36:58 +04:00
|
|
|
#include "CGCXX.h"
|
2009-07-31 22:25:34 +04:00
|
|
|
#include "clang/AST/Type.h"
|
2009-10-07 05:45:02 +04:00
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2009-04-15 09:36:58 +04:00
|
|
|
|
2009-02-13 03:10:09 +03:00
|
|
|
namespace llvm {
|
|
|
|
class raw_ostream;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
class ASTContext;
|
2009-04-15 09:36:58 +04:00
|
|
|
class CXXConstructorDecl;
|
2009-04-17 05:58:57 +04:00
|
|
|
class CXXDestructorDecl;
|
2009-09-07 08:27:52 +04:00
|
|
|
class FunctionDecl;
|
2009-02-13 03:10:09 +03:00
|
|
|
class NamedDecl;
|
2009-04-13 22:02:10 +04:00
|
|
|
class VarDecl;
|
2009-09-09 19:08:12 +04:00
|
|
|
|
2009-10-07 05:06:45 +04:00
|
|
|
class MangleContext {
|
|
|
|
ASTContext &Context;
|
2009-10-07 05:45:02 +04:00
|
|
|
|
|
|
|
llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds;
|
|
|
|
|
2009-10-07 05:06:45 +04:00
|
|
|
public:
|
|
|
|
explicit MangleContext(ASTContext &Context)
|
|
|
|
: Context(Context) { }
|
|
|
|
|
|
|
|
ASTContext &getASTContext() const { return Context; }
|
2009-10-07 05:45:02 +04:00
|
|
|
|
|
|
|
uint64_t getAnonymousStructId(const TagDecl *TD) {
|
|
|
|
std::pair<llvm::DenseMap<const TagDecl *,
|
|
|
|
uint64_t>::iterator, bool> Result =
|
|
|
|
AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
|
|
|
|
return Result.first->second;
|
|
|
|
}
|
2009-10-07 05:06:45 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
bool mangleName(MangleContext &Context, const NamedDecl *D,
|
2009-02-13 03:10:09 +03:00
|
|
|
llvm::raw_ostream &os);
|
2009-10-07 05:06:45 +04:00
|
|
|
void mangleThunk(MangleContext &Context, const FunctionDecl *FD,
|
|
|
|
int64_t n, int64_t vn, llvm::raw_ostream &os);
|
|
|
|
void mangleCovariantThunk(MangleContext &Context, const FunctionDecl *FD,
|
|
|
|
int64_t nv_t, int64_t v_t,
|
|
|
|
int64_t nv_r, int64_t v_r,
|
2009-09-12 03:25:56 +04:00
|
|
|
llvm::raw_ostream &os);
|
2009-10-07 05:06:45 +04:00
|
|
|
void mangleGuardVariable(MangleContext &Context, const VarDecl *D,
|
2009-04-13 22:02:10 +04:00
|
|
|
llvm::raw_ostream &os);
|
2009-10-12 01:24:51 +04:00
|
|
|
void mangleCXXVtable(MangleContext &Context, const CXXRecordDecl *RD,
|
|
|
|
llvm::raw_ostream &os);
|
2009-10-28 04:51:46 +03:00
|
|
|
void mangleCXXVTT(MangleContext &Context, const CXXRecordDecl *RD,
|
|
|
|
llvm::raw_ostream &os);
|
2009-10-30 04:52:02 +03:00
|
|
|
void mangleCXXRtti(MangleContext &Context, QualType T,
|
2009-10-12 01:24:51 +04:00
|
|
|
llvm::raw_ostream &os);
|
2009-10-07 05:06:45 +04:00
|
|
|
void mangleCXXCtor(MangleContext &Context, const CXXConstructorDecl *D,
|
|
|
|
CXXCtorType Type, llvm::raw_ostream &os);
|
|
|
|
void mangleCXXDtor(MangleContext &Context, const CXXDestructorDecl *D,
|
|
|
|
CXXDtorType Type, llvm::raw_ostream &os);
|
2009-02-13 03:10:09 +03:00
|
|
|
}
|
|
|
|
|
2009-09-09 19:08:12 +04:00
|
|
|
#endif
|