MangleNumberingContext.h revision 07369dde9d72213bf8a48288cd8b29999af9a40c
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 Type;
27
28/// \brief Keeps track of the mangled names of lambda expressions and block
29/// literals within a particular context.
30class MangleNumberingContext
31    : public RefCountedBase<MangleNumberingContext> {
32  llvm::DenseMap<const Type *, unsigned> ManglingNumbers;
33
34public:
35  /// \brief Retrieve the mangling number of a new lambda expression with the
36  /// given call operator within this context.
37  unsigned getManglingNumber(CXXMethodDecl *CallOperator);
38
39  /// \brief Retrieve the mangling number of a new block literal within this
40  /// context.
41  unsigned getManglingNumber(BlockDecl *BD);
42};
43
44} // end namespace clang
45#endif
46