Add a MangleContext and pass it to all mangle functions. It will be used for keeping state, such as identifiers assigned to anonymous structs as well as scope encoding.
llvm-svn: 83442
diff --git a/clang/lib/CodeGen/Mangle.h b/clang/lib/CodeGen/Mangle.h
index 91143a5..8ab5d5e 100644
--- a/clang/lib/CodeGen/Mangle.h
+++ b/clang/lib/CodeGen/Mangle.h
@@ -33,21 +33,31 @@
class NamedDecl;
class VarDecl;
- bool mangleName(const NamedDecl *D, ASTContext &Context,
+ class MangleContext {
+ ASTContext &Context;
+ public:
+ explicit MangleContext(ASTContext &Context)
+ : Context(Context) { }
+
+ ASTContext &getASTContext() const { return Context; }
+ };
+
+ bool mangleName(MangleContext &Context, const NamedDecl *D,
llvm::raw_ostream &os);
- void mangleThunk(const FunctionDecl *FD, int64_t n, int64_t vn,
- ASTContext &Context, 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, ASTContext &Context,
+ 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(const VarDecl *D, ASTContext &Context,
+ void mangleGuardVariable(MangleContext &Context, const VarDecl *D,
llvm::raw_ostream &os);
- void mangleCXXVtable(QualType T, ASTContext &Context, llvm::raw_ostream &os);
- void mangleCXXRtti(QualType T, ASTContext &Context, llvm::raw_ostream &os);
- void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
- ASTContext &Context, llvm::raw_ostream &os);
- void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
- ASTContext &Context, llvm::raw_ostream &os);
+ void mangleCXXVtable(MangleContext &Context, QualType T, llvm::raw_ostream &os);
+ void mangleCXXRtti(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