1 //===--- MangleNumberingContext.cpp - Context for mangling numbers --------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the LambdaMangleContext class, which keeps track of
11 // the Itanium C++ ABI mangling numbers for lambda expressions.
13 //===----------------------------------------------------------------------===//
15 #include "clang/AST/MangleNumberingContext.h"
16 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/DeclCXX.h"
19 using namespace clang;
22 MangleNumberingContext::getManglingNumber(const CXXMethodDecl *CallOperator) {
23 const FunctionProtoType *Proto
24 = CallOperator->getType()->getAs<FunctionProtoType>();
25 ASTContext &Context = CallOperator->getASTContext();
27 QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getArgTypes(),
28 FunctionProtoType::ExtProtoInfo());
29 Key = Context.getCanonicalType(Key);
30 return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
34 MangleNumberingContext::getManglingNumber(const BlockDecl *BD) {
35 // FIXME: Compute a BlockPointerType? Not obvious how.
37 return ++ManglingNumbers[Ty];
41 MangleNumberingContext::getManglingNumber(const TagDecl *TD) {
42 return ++TagManglingNumbers[TD->getIdentifier()];