diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-21 09:06:10 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-21 09:06:10 +0000 |
commit | 1b0771170921b9e752a50ea2cf87814bff92c834 (patch) | |
tree | a01fd6ceaac4b355942ebc66155230699e62ff09 /lib/CodeGen/Mangle.h | |
parent | c52365674b5b157a0486f75c12dd9f4cc41d8089 (diff) |
Sink free mangle* methods into MangleContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/Mangle.h')
-rw-r--r-- | lib/CodeGen/Mangle.h | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/lib/CodeGen/Mangle.h b/lib/CodeGen/Mangle.h index 458708fca6..8268aa2869 100644 --- a/lib/CodeGen/Mangle.h +++ b/lib/CodeGen/Mangle.h @@ -23,61 +23,59 @@ #include "llvm/ADT/DenseMap.h" namespace llvm { - class raw_ostream; +class raw_ostream; } 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; - class MangleContext { - ASTContext &Context; - - llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds; +/// MangleContext - Context for tracking state which persists across multiple +/// calls to the C++ name mangler. +class MangleContext { + ASTContext &Context; - public: - explicit MangleContext(ASTContext &Context) + llvm::DenseMap<const TagDecl *, uint64_t> AnonStructIds; + +public: + explicit MangleContext(ASTContext &Context) : Context(Context) { } - - ASTContext &getASTContext() const { return Context; } - - uint64_t getAnonymousStructId(const TagDecl *TD) { - std::pair<llvm::DenseMap<const TagDecl *, - uint64_t>::iterator, bool> Result = + + ASTContext &getASTContext() const { return Context; } + + 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; - } - }; + return Result.first->second; + } - bool mangleName(MangleContext &Context, const NamedDecl *D, - llvm::raw_ostream &os); - 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, - llvm::raw_ostream &os); - void mangleGuardVariable(MangleContext &Context, const VarDecl *D, - llvm::raw_ostream &os); - void mangleCXXVtable(MangleContext &Context, const CXXRecordDecl *RD, - llvm::raw_ostream &os); - void mangleCXXVTT(MangleContext &Context, const CXXRecordDecl *RD, - llvm::raw_ostream &os); - void mangleCXXCtorVtable(MangleContext &Context, const CXXRecordDecl *RD, - int64_t Offset, const CXXRecordDecl *Type, - llvm::raw_ostream &os); - void mangleCXXRtti(MangleContext &Context, QualType T, + /// @name Mangler Entry Points + /// @{ + + bool mangleName(const NamedDecl *D, llvm::raw_ostream &os); + void mangleThunk(const FunctionDecl *FD, int64_t n, int64_t vn, + llvm::raw_ostream &os); + void mangleCovariantThunk(const FunctionDecl *FD, int64_t nv_t, int64_t v_t, + int64_t nv_r, int64_t v_r, llvm::raw_ostream &os); + void mangleGuardVariable(const VarDecl *D, llvm::raw_ostream &os); + void mangleCXXVtable(const CXXRecordDecl *RD, llvm::raw_ostream &os); + void mangleCXXVTT(const CXXRecordDecl *RD, llvm::raw_ostream &os); + void mangleCXXCtorVtable(const CXXRecordDecl *RD, int64_t Offset, + const CXXRecordDecl *Type, llvm::raw_ostream &os); + void mangleCXXRtti(QualType T, llvm::raw_ostream &os); + void mangleCXXRttiName(QualType T, llvm::raw_ostream &os); + void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, + llvm::raw_ostream &os); + void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, llvm::raw_ostream &os); - void mangleCXXRttiName(MangleContext &Context, QualType T, - llvm::raw_ostream &os); - 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); + + /// @} +}; } #endif |