1 //==--- 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"
20 #include "CodeGenModule.h"
21 #include "clang/CodeGen/CGFunctionInfo.h"
22 #include "clang/Frontend/CodeGenOptions.h"
23 #include "clang/Lex/HeaderSearchOptions.h"
24 #include "clang/Lex/PreprocessorOptions.h"
25
26 using namespace clang;
27 using namespace CodeGen;
28
29 const CGFunctionInfo &
arrangeObjCMessageSendSignature(CodeGenModule & CGM,const ObjCMethodDecl * MD,QualType receiverType)30 CodeGen::arrangeObjCMessageSendSignature(CodeGenModule &CGM,
31 const ObjCMethodDecl *MD,
32 QualType receiverType) {
33 return CGM.getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
34 }
35
36 const CGFunctionInfo &
arrangeFreeFunctionType(CodeGenModule & CGM,CanQual<FunctionProtoType> Ty,const FunctionDecl * FD)37 CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
38 CanQual<FunctionProtoType> Ty,
39 const FunctionDecl *FD) {
40 return CGM.getTypes().arrangeFreeFunctionType(Ty, FD);
41 }
42
43 const CGFunctionInfo &
arrangeFreeFunctionType(CodeGenModule & CGM,CanQual<FunctionNoProtoType> Ty)44 CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM,
45 CanQual<FunctionNoProtoType> Ty) {
46 return CGM.getTypes().arrangeFreeFunctionType(Ty);
47 }
48
49 const CGFunctionInfo &
arrangeCXXMethodType(CodeGenModule & CGM,const CXXRecordDecl * RD,const FunctionProtoType * FTP,const CXXMethodDecl * MD)50 CodeGen::arrangeCXXMethodType(CodeGenModule &CGM,
51 const CXXRecordDecl *RD,
52 const FunctionProtoType *FTP,
53 const CXXMethodDecl *MD) {
54 return CGM.getTypes().arrangeCXXMethodType(RD, FTP, MD);
55 }
56
57 const CGFunctionInfo &
arrangeFreeFunctionCall(CodeGenModule & CGM,CanQualType returnType,ArrayRef<CanQualType> argTypes,FunctionType::ExtInfo info,RequiredArgs args)58 CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM,
59 CanQualType returnType,
60 ArrayRef<CanQualType> argTypes,
61 FunctionType::ExtInfo info,
62 RequiredArgs args) {
63 return CGM.getTypes().arrangeLLVMFunctionInfo(
64 returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
65 info, {}, args);
66 }
67