blob: 166f44f816f31183e03b40c03eeeed93eabd885f [file] [log] [blame]
Mark Lacey8b549992013-10-30 21:53:58 +00001//==--- CodeGenABITypes.cpp - Convert Clang types to LLVM types for ABI ----==//
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// CodeGenABITypes is a simple interface for getting LLVM types for
11// the parameters and the return value of a function given the Clang
12// types.
13//
14// The class is implemented as a public wrapper around the private
15// CodeGenTypes class in lib/CodeGen.
16//
17//===----------------------------------------------------------------------===//
18
19#include "clang/CodeGen/CodeGenABITypes.h"
Mark Lacey8b549992013-10-30 21:53:58 +000020#include "CodeGenModule.h"
Stephen Hines651f13c2014-04-23 16:59:28 -070021#include "clang/CodeGen/CGFunctionInfo.h"
22#include "clang/Frontend/CodeGenOptions.h"
Pirama Arumuga Nainar87d948e2016-03-03 15:49:35 -080023#include "clang/Lex/HeaderSearchOptions.h"
24#include "clang/Lex/PreprocessorOptions.h"
Mark Lacey8b549992013-10-30 21:53:58 +000025
26using namespace clang;
27using namespace CodeGen;
28
Mark Lacey8b549992013-10-30 21:53:58 +000029const CGFunctionInfo &
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070030CodeGen::arrangeObjCMessageSendSignature(CodeGenModule &CGM,
31 const ObjCMethodDecl *MD,
32 QualType receiverType) {
33 return CGM.getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
Mark Lacey8b549992013-10-30 21:53:58 +000034}
35
36const CGFunctionInfo &
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070037CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
38 CanQual<FunctionProtoType> Ty,
39 const FunctionDecl *FD) {
40 return CGM.getTypes().arrangeFreeFunctionType(Ty, FD);
Mark Lacey8b549992013-10-30 21:53:58 +000041}
42
43const CGFunctionInfo &
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070044CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
45 CanQual<FunctionNoProtoType> Ty) {
46 return CGM.getTypes().arrangeFreeFunctionType(Ty);
Mark Lacey8b549992013-10-30 21:53:58 +000047}
48
49const CGFunctionInfo &
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070050CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
51 const CXXRecordDecl *RD,
52 const FunctionProtoType *FTP,
53 const CXXMethodDecl *MD) {
54 return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
Mark Lacey8b549992013-10-30 21:53:58 +000055}
56
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070057const CGFunctionInfo &
58CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
59 CanQualType returnType,
60 ArrayRef<CanQualType> argTypes,
61 FunctionType::ExtInfo info,
62 RequiredArgs args) {
63 return CGM.getTypes().arrangeLLVMFunctionInfo(
Stephen Hines0e2c34f2015-03-23 12:09:02 -070064 returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
Pirama Arumuga Nainar4967a712016-09-19 22:19:55 -070065 info, {}, args);
Mark Lacey8b549992013-10-30 21:53:58 +000066}