]>
git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/lib/AST/LambdaMangleContext.cpp
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 //===----------------------------------------------------------------------===//
15 #include "clang/AST/LambdaMangleContext.h"
16 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/DeclCXX.h"
19 using namespace clang
;
21 unsigned LambdaMangleContext::getManglingNumber(CXXMethodDecl
*CallOperator
) {
22 const FunctionProtoType
*Proto
23 = CallOperator
->getType()->getAs
<FunctionProtoType
>();
24 ASTContext
&Context
= CallOperator
->getASTContext();
26 QualType Key
= Context
.getFunctionType(Context
.VoidTy
,
27 Proto
->arg_type_begin(),
29 FunctionProtoType::ExtProtoInfo());
30 Key
= Context
.getCanonicalType(Key
);
31 return ++ManglingNumbers
[Key
->castAs
<FunctionProtoType
>()];