1 //==--- CodeGenABITypes.cpp - Convert Clang types to LLVM types for ABI ----==//
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 // CodeGenABITypes is a simple interface for getting LLVM types for
11 // the parameters and the return value of a function given the Clang
14 // The class is implemented as a public wrapper around the private
15 // CodeGenTypes class in lib/CodeGen.
17 //===----------------------------------------------------------------------===//
19 #include "clang/CodeGen/CodeGenABITypes.h"
21 #include "clang/CodeGen/CGFunctionInfo.h"
22 #include "CodeGenModule.h"
24 using namespace clang;
25 using namespace CodeGen;
27 CodeGenABITypes::CodeGenABITypes(ASTContext &C,
28 const CodeGenOptions &CodeGenOpts,
30 const llvm::DataLayout &TD,
31 DiagnosticsEngine &Diags)
32 : CGM(new CodeGen::CodeGenModule(C, CodeGenOpts, M, TD, Diags)) {
35 CodeGenABITypes::~CodeGenABITypes()
40 const CGFunctionInfo &
41 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
42 QualType receiverType) {
43 return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
46 const CGFunctionInfo &
47 CodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> Ty) {
48 return CGM->getTypes().arrangeFreeFunctionType(Ty);
51 const CGFunctionInfo &
52 CodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> Ty) {
53 return CGM->getTypes().arrangeFreeFunctionType(Ty);
56 const CGFunctionInfo &
57 CodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD,
58 const FunctionProtoType *FTP) {
59 return CGM->getTypes().arrangeCXXMethodType(RD, FTP);
62 const CGFunctionInfo &
63 CodeGenABITypes::arrangeLLVMFunctionInfo(CanQualType returnType,
64 llvm::ArrayRef<CanQualType> argTypes,
65 FunctionType::ExtInfo info,
67 return CGM->getTypes().arrangeLLVMFunctionInfo(returnType, argTypes,