diff options
Diffstat (limited to 'clang/lib/CodeGen/Mangle.h')
-rw-r--r-- | clang/lib/CodeGen/Mangle.h | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/clang/lib/CodeGen/Mangle.h b/clang/lib/CodeGen/Mangle.h index 458708fca6a..8268aa2869d 100644 --- a/clang/lib/CodeGen/Mangle.h +++ b/clang/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 |