2013-07-02 04:22:57 +08:00
|
|
|
//===--- MangleNumberingContext.cpp - Context for mangling numbers --------===//
|
2012-02-21 03:44:39 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the LambdaMangleContext class, which keeps track of
|
|
|
|
// the Itanium C++ ABI mangling numbers for lambda expressions.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2012-07-05 01:04:04 +08:00
|
|
|
|
2013-07-02 04:22:57 +08:00
|
|
|
#include "clang/AST/MangleNumberingContext.h"
|
2012-07-05 01:04:04 +08:00
|
|
|
#include "clang/AST/ASTContext.h"
|
2012-02-21 03:44:39 +08:00
|
|
|
#include "clang/AST/DeclCXX.h"
|
|
|
|
|
|
|
|
using namespace clang;
|
|
|
|
|
2013-07-02 04:22:57 +08:00
|
|
|
unsigned
|
2013-07-10 08:30:46 +08:00
|
|
|
MangleNumberingContext::getManglingNumber(const CXXMethodDecl *CallOperator) {
|
2012-02-21 03:44:39 +08:00
|
|
|
const FunctionProtoType *Proto
|
|
|
|
= CallOperator->getType()->getAs<FunctionProtoType>();
|
|
|
|
ASTContext &Context = CallOperator->getASTContext();
|
2013-06-11 04:51:09 +08:00
|
|
|
|
2014-01-21 04:26:09 +08:00
|
|
|
QualType Key = Context.getFunctionType(Context.VoidTy, Proto->getParamTypes(),
|
2013-06-11 04:51:09 +08:00
|
|
|
FunctionProtoType::ExtProtoInfo());
|
2012-02-21 03:44:39 +08:00
|
|
|
Key = Context.getCanonicalType(Key);
|
|
|
|
return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
|
|
|
|
}
|
2013-07-02 04:22:57 +08:00
|
|
|
|
|
|
|
unsigned
|
2013-07-10 08:30:46 +08:00
|
|
|
MangleNumberingContext::getManglingNumber(const BlockDecl *BD) {
|
2013-07-02 04:22:57 +08:00
|
|
|
// FIXME: Compute a BlockPointerType? Not obvious how.
|
2014-05-12 13:36:57 +08:00
|
|
|
const Type *Ty = nullptr;
|
2013-07-02 04:22:57 +08:00
|
|
|
return ++ManglingNumbers[Ty];
|
|
|
|
}
|
2013-07-10 08:30:46 +08:00
|
|
|
|
|
|
|
unsigned
|
2014-03-05 16:57:59 +08:00
|
|
|
MangleNumberingContext::getStaticLocalNumber(const VarDecl *VD) {
|
|
|
|
// FIXME: Compute a BlockPointerType? Not obvious how.
|
2014-05-12 13:36:57 +08:00
|
|
|
const Type *Ty = nullptr;
|
2014-03-05 16:57:59 +08:00
|
|
|
return ++ManglingNumbers[Ty];
|
2013-07-10 08:30:46 +08:00
|
|
|
}
|