]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/AST/LambdaMangleContext.cpp
Import byacc from invisible island, it brings us lots of compatibilities with
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / AST / LambdaMangleContext.cpp
1 //===--- LambdaMangleContext.cpp - Context for mangling lambdas -*- 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 LambdaMangleContext class, which keeps track of
11 //  the Itanium C++ ABI mangling numbers for lambda expressions.
12 //
13 //===----------------------------------------------------------------------===//
14 #include "clang/AST/LambdaMangleContext.h"
15 #include "clang/AST/DeclCXX.h"
16
17 using namespace clang;
18
19 unsigned LambdaMangleContext::getManglingNumber(CXXMethodDecl *CallOperator) {
20   const FunctionProtoType *Proto
21     = CallOperator->getType()->getAs<FunctionProtoType>();
22   ASTContext &Context = CallOperator->getASTContext();
23   
24   QualType Key = Context.getFunctionType(Context.VoidTy, 
25                                          Proto->arg_type_begin(),
26                                          Proto->getNumArgs(),
27                                          FunctionProtoType::ExtProtoInfo());
28   Key = Context.getCanonicalType(Key);
29   return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
30 }