1 //===--- LambdaMangleContext.cpp - Context for mangling lambdas -*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
14 #include "clang/AST/LambdaMangleContext.h"
15 #include "clang/AST/DeclCXX.h"
17 using namespace clang;
19 unsigned LambdaMangleContext::getManglingNumber(CXXMethodDecl *CallOperator) {
20 const FunctionProtoType *Proto
21 = CallOperator->getType()->getAs<FunctionProtoType>();
22 ASTContext &Context = CallOperator->getASTContext();
24 QualType Key = Context.getFunctionType(Context.VoidTy,
25 Proto->arg_type_begin(),
27 FunctionProtoType::ExtProtoInfo());
28 Key = Context.getCanonicalType(Key);
29 return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];