opnsense-src/lib/CodeGen/Mangle.h

96 lines
3.1 KiB
C
Raw Normal View History

2009-06-02 13:58:47 -04:00
//===--- Mangle.h - Mangle C++ Names ----------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_CODEGEN_MANGLE_H
#define LLVM_CLANG_CODEGEN_MANGLE_H
#include "CGCXX.h"
2009-10-14 14:03:49 -04:00
#include "clang/AST/Type.h"
#include "llvm/ADT/DenseMap.h"
2009-06-02 13:58:47 -04:00
namespace llvm {
2009-12-01 06:08:04 -05:00
template<typename T> class SmallVectorImpl;
2009-06-02 13:58:47 -04:00
}
namespace clang {
class ASTContext;
class CXXConstructorDecl;
class CXXDestructorDecl;
2009-10-14 14:03:49 -04:00
class FunctionDecl;
2009-06-02 13:58:47 -04:00
class NamedDecl;
class VarDecl;
2009-10-14 14:03:49 -04:00
2009-12-01 06:08:04 -05:00
namespace CodeGen {
class CovariantThunkAdjustment;
class ThunkAdjustment;
/// MangleContext - Context for tracking state which persists across multiple
/// calls to the C++ name mangler.
class MangleContext {
ASTContext &Context;
2009-10-14 14:03:49 -04:00
2009-12-01 06:08:04 -05:00
llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds;
public:
explicit MangleContext(ASTContext &Context)
2009-10-14 14:03:49 -04:00
: Context(Context) { }
2009-12-01 06:08:04 -05:00
ASTContext &getASTContext() const { return Context; }
uint64_t getAnonymousStructId(const TagDecl *TD) {
std::pair<llvm::DenseMap<const TagDecl *,
uint64_t>::iterator, bool> Result =
2009-10-14 14:03:49 -04:00
AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
2009-12-01 06:08:04 -05:00
return Result.first->second;
}
/// @name Mangler Entry Points
/// @{
2009-10-14 14:03:49 -04:00
2009-12-01 06:08:04 -05:00
bool shouldMangleDeclName(const NamedDecl *D);
void mangleName(const NamedDecl *D, llvm::SmallVectorImpl<char> &);
void mangleThunk(const FunctionDecl *FD,
const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &);
2009-12-15 13:49:47 -05:00
void mangleCXXDtorThunk(const CXXDestructorDecl *D, CXXDtorType Type,
const ThunkAdjustment &ThisAdjustment,
llvm::SmallVectorImpl<char> &);
2009-12-01 06:08:04 -05:00
void mangleCovariantThunk(const FunctionDecl *FD,
const CovariantThunkAdjustment& Adjustment,
llvm::SmallVectorImpl<char> &);
void mangleGuardVariable(const VarDecl *D, llvm::SmallVectorImpl<char> &);
void mangleCXXVtable(const CXXRecordDecl *RD, llvm::SmallVectorImpl<char> &);
void mangleCXXVTT(const CXXRecordDecl *RD, llvm::SmallVectorImpl<char> &);
void mangleCXXCtorVtable(const CXXRecordDecl *RD, int64_t Offset,
const CXXRecordDecl *Type,
llvm::SmallVectorImpl<char> &);
2009-12-15 13:49:47 -05:00
void mangleCXXRTTI(QualType T, llvm::SmallVectorImpl<char> &);
void mangleCXXRTTIName(QualType T, llvm::SmallVectorImpl<char> &);
2009-12-01 06:08:04 -05:00
void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
llvm::SmallVectorImpl<char> &);
void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
llvm::SmallVectorImpl<char> &);
/// @}
};
}
2009-06-02 13:58:47 -04:00
}
2009-10-14 14:03:49 -04:00
#endif