LambdaMangleContext.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132
  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/ASTContext.h"
  16. #include "clang/AST/DeclCXX.h"
  17. using namespace clang;
  18. unsigned LambdaMangleContext::getManglingNumber(CXXMethodDecl *CallOperator) {
  19. const FunctionProtoType *Proto
  20. = CallOperator->getType()->getAs<FunctionProtoType>();
  21. ASTContext &Context = CallOperator->getASTContext();
  22. QualType Key = Context.getFunctionType(Context.VoidTy,
  23. Proto->arg_type_begin(),
  24. Proto->getNumArgs(),
  25. FunctionProtoType::ExtProtoInfo());
  26. Key = Context.getCanonicalType(Key);
  27. return ++ManglingNumbers[Key->castAs<FunctionProtoType>()];
  28. }