MangleNumberingContext.h revision 5e867c8a07d82da0d3b0a43402ee4f1c6ba416e9
1//=== MangleNumberingContext.h - Context for mangling numbers ---*- C++ -*-===//
2//
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//  This file defines the LambdaBlockMangleContext interface, which keeps track
11//  of the Itanium C++ ABI mangling numbers for lambda expressions and block
12//  literals.
13//
14//===----------------------------------------------------------------------===//
15#ifndef LLVM_CLANG_MANGLENUMBERINGCONTEXT_H
16#define LLVM_CLANG_MANGLENUMBERINGCONTEXT_H
17
18#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/DenseMap.h"
20#include "llvm/ADT/IntrusiveRefCntPtr.h"
21
22namespace clang {
23
24class BlockDecl;
25class CXXMethodDecl;
26class IdentifierInfo;
27class TagDecl;
28class Type;
29class VarDecl;
30
31/// \brief Keeps track of the mangled names of lambda expressions and block
32/// literals within a particular context.
33class MangleNumberingContext
34    : public RefCountedBase<MangleNumberingContext> {
35  llvm::DenseMap<const Type *, unsigned> ManglingNumbers;
36  llvm::DenseMap<IdentifierInfo*, unsigned> VarManglingNumbers;
37  llvm::DenseMap<IdentifierInfo*, unsigned> TagManglingNumbers;
38
39public:
40  /// \brief Retrieve the mangling number of a new lambda expression with the
41  /// given call operator within this context.
42  unsigned getManglingNumber(const CXXMethodDecl *CallOperator);
43
44  /// \brief Retrieve the mangling number of a new block literal within this
45  /// context.
46  unsigned getManglingNumber(const BlockDecl *BD);
47
48  /// \brief Retrieve the mangling number of a static local variable within
49  /// this context.
50  unsigned getManglingNumber(const VarDecl *VD);
51
52  /// \brief Retrieve the mangling number of a static local variable within
53  /// this context.
54  unsigned getManglingNumber(const TagDecl *TD);
55};
56
57} // end namespace clang
58#endif
59