blob: 8ab5d5edf36a7c169accf48e7112adbcae4d3015 [file] [log] [blame]
Douglas Gregor6ec36682009-02-18 23:53:56 +00001//===--- Mangle.h - Mangle C++ Names ----------------------------*- C++ -*-===//
Douglas Gregor5f2bfd42009-02-13 00:10:09 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Implements C++ name mangling according to the Itanium C++ ABI,
11// which is used in GCC 3.2 and newer (and many compilers that are
12// ABI-compatible with GCC):
13//
14// http://www.codesourcery.com/public/cxx-abi/abi.html
15//
16//===----------------------------------------------------------------------===//
Chris Lattnerca3f25c2009-03-21 08:24:40 +000017
Douglas Gregor5f2bfd42009-02-13 00:10:09 +000018#ifndef LLVM_CLANG_CODEGEN_MANGLE_H
19#define LLVM_CLANG_CODEGEN_MANGLE_H
20
Anders Carlsson3ac86b52009-04-15 05:36:58 +000021#include "CGCXX.h"
Mike Stumpf1216772009-07-31 18:25:34 +000022#include "clang/AST/Type.h"
Anders Carlsson3ac86b52009-04-15 05:36:58 +000023
Douglas Gregor5f2bfd42009-02-13 00:10:09 +000024namespace llvm {
25 class raw_ostream;
26}
27
28namespace clang {
29 class ASTContext;
Anders Carlsson3ac86b52009-04-15 05:36:58 +000030 class CXXConstructorDecl;
Anders Carlsson27ae5362009-04-17 01:58:57 +000031 class CXXDestructorDecl;
Mike Stumpdec025b2009-09-07 04:27:52 +000032 class FunctionDecl;
Douglas Gregor5f2bfd42009-02-13 00:10:09 +000033 class NamedDecl;
Anders Carlsson41aa8c12009-04-13 18:02:10 +000034 class VarDecl;
Mike Stump1eb44332009-09-09 15:08:12 +000035
Anders Carlssonb5404912009-10-07 01:06:45 +000036 class MangleContext {
37 ASTContext &Context;
38 public:
39 explicit MangleContext(ASTContext &Context)
40 : Context(Context) { }
41
42 ASTContext &getASTContext() const { return Context; }
43 };
44
45 bool mangleName(MangleContext &Context, const NamedDecl *D,
Douglas Gregor5f2bfd42009-02-13 00:10:09 +000046 llvm::raw_ostream &os);
Anders Carlssonb5404912009-10-07 01:06:45 +000047 void mangleThunk(MangleContext &Context, const FunctionDecl *FD,
48 int64_t n, int64_t vn, llvm::raw_ostream &os);
49 void mangleCovariantThunk(MangleContext &Context, const FunctionDecl *FD,
50 int64_t nv_t, int64_t v_t,
51 int64_t nv_r, int64_t v_r,
Mike Stump6e319f62009-09-11 23:25:56 +000052 llvm::raw_ostream &os);
Anders Carlssonb5404912009-10-07 01:06:45 +000053 void mangleGuardVariable(MangleContext &Context, const VarDecl *D,
Anders Carlsson41aa8c12009-04-13 18:02:10 +000054 llvm::raw_ostream &os);
Anders Carlssonb5404912009-10-07 01:06:45 +000055 void mangleCXXVtable(MangleContext &Context, QualType T, llvm::raw_ostream &os);
56 void mangleCXXRtti(MangleContext &Context, QualType T, llvm::raw_ostream &os);
57 void mangleCXXCtor(MangleContext &Context, const CXXConstructorDecl *D,
58 CXXCtorType Type, llvm::raw_ostream &os);
59 void mangleCXXDtor(MangleContext &Context, const CXXDestructorDecl *D,
60 CXXDtorType Type, llvm::raw_ostream &os);
Douglas Gregor5f2bfd42009-02-13 00:10:09 +000061}
62
Mike Stump1eb44332009-09-09 15:08:12 +000063#endif