CodeGenABITypes.cpp revision 261991
167754Smsmith//==--- CodeGenABITypes.cpp - Convert Clang types to LLVM types for ABI ----==// 267754Smsmith// 377424Smsmith// The LLVM Compiler Infrastructure 499679Siwasaki// 567754Smsmith// This file is distributed under the University of Illinois Open Source 667754Smsmith// License. See LICENSE.TXT for details. 767754Smsmith// 867754Smsmith//===----------------------------------------------------------------------===// 967754Smsmith// 1067754Smsmith// CodeGenABITypes is a simple interface for getting LLVM types for 1167754Smsmith// the parameters and the return value of a function given the Clang 1291116Smsmith// types. 1370243Smsmith// 1467754Smsmith// The class is implemented as a public wrapper around the private 1567754Smsmith// CodeGenTypes class in lib/CodeGen. 1667754Smsmith// 1767754Smsmith//===----------------------------------------------------------------------===// 1867754Smsmith 1967754Smsmith#include "clang/CodeGen/CodeGenABITypes.h" 2067754Smsmith 2167754Smsmith#include "clang/CodeGen/CGFunctionInfo.h" 2267754Smsmith#include "CodeGenModule.h" 2367754Smsmith 2467754Smsmithusing namespace clang; 2567754Smsmithusing namespace CodeGen; 2667754Smsmith 2767754SmsmithCodeGenABITypes::CodeGenABITypes(ASTContext &C, 2867754Smsmith const CodeGenOptions &CodeGenOpts, 2967754Smsmith llvm::Module &M, 3067754Smsmith const llvm::DataLayout &TD, 3167754Smsmith DiagnosticsEngine &Diags) 3267754Smsmith : CGM(new CodeGen::CodeGenModule(C, CodeGenOpts, M, TD, Diags)) { 3367754Smsmith} 3467754Smsmith 3567754SmsmithCodeGenABITypes::~CodeGenABITypes() 3667754Smsmith{ 3767754Smsmith delete CGM; 3867754Smsmith} 3967754Smsmith 4067754Smsmithconst CGFunctionInfo & 4167754SmsmithCodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, 4267754Smsmith QualType receiverType) { 4367754Smsmith return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType); 4467754Smsmith} 4567754Smsmith 4667754Smsmithconst CGFunctionInfo & 4767754SmsmithCodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> Ty) { 4867754Smsmith return CGM->getTypes().arrangeFreeFunctionType(Ty); 4967754Smsmith} 5067754Smsmith 5167754Smsmithconst CGFunctionInfo & 5267754SmsmithCodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> Ty) { 5367754Smsmith return CGM->getTypes().arrangeFreeFunctionType(Ty); 5467754Smsmith} 5567754Smsmith 5667754Smsmithconst CGFunctionInfo & 5767754SmsmithCodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD, 5867754Smsmith const FunctionProtoType *FTP) { 5967754Smsmith return CGM->getTypes().arrangeCXXMethodType(RD, FTP); 6067754Smsmith} 6167754Smsmith 6267754Smsmithconst CGFunctionInfo & 6367754SmsmithCodeGenABITypes::arrangeLLVMFunctionInfo(CanQualType returnType, 6467754Smsmith llvm::ArrayRef<CanQualType> argTypes, 6567754Smsmith FunctionType::ExtInfo info, 6667754Smsmith RequiredArgs args) { 6767754Smsmith return CGM->getTypes().arrangeLLVMFunctionInfo(returnType, argTypes, 6867754Smsmith info, args); 6967754Smsmith} 7067754Smsmith