Sink free mangle* methods into MangleContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89547 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.h b/lib/CodeGen/Mangle.h
index 458708f..8268aa2 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 =
- AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
- 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,
+ 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;
+ }
+
+ /// @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 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);
+ void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
+ llvm::raw_ostream &os);
+
+ /// @}
+};
}
#endif