Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 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" |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 20 | #include "CodeGenModule.h" |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 21 | #include "clang/CodeGen/CGFunctionInfo.h" |
| 22 | #include "clang/Frontend/CodeGenOptions.h" |
Pirama Arumuga Nainar | 87d948e | 2016-03-03 15:49:35 -0800 | [diff] [blame] | 23 | #include "clang/Lex/HeaderSearchOptions.h" |
| 24 | #include "clang/Lex/PreprocessorOptions.h" |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 25 | |
| 26 | using namespace clang; |
| 27 | using namespace CodeGen; |
| 28 | |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 29 | const CGFunctionInfo & |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 30 | CodeGen::arrangeObjCMessageSendSignature(CodeGenModule &CGM, |
| 31 | const ObjCMethodDecl *MD, |
| 32 | QualType receiverType) { |
| 33 | return CGM.getTypes().arrangeObjCMessageSendSignature(MD, receiverType); |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | const CGFunctionInfo & |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 37 | CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM, |
| 38 | CanQual<FunctionProtoType> Ty, |
| 39 | const FunctionDecl *FD) { |
| 40 | return CGM.getTypes().arrangeFreeFunctionType(Ty, FD); |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | const CGFunctionInfo & |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 44 | CodeGen::arrangeFreeFunctionType(CodeGenModule &CGM, |
| 45 | CanQual<FunctionNoProtoType> Ty) { |
| 46 | return CGM.getTypes().arrangeFreeFunctionType(Ty); |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | const CGFunctionInfo & |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 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); |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 55 | } |
| 56 | |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 57 | const CGFunctionInfo & |
| 58 | CodeGen::arrangeFreeFunctionCall(CodeGenModule &CGM, |
| 59 | CanQualType returnType, |
| 60 | ArrayRef<CanQualType> argTypes, |
| 61 | FunctionType::ExtInfo info, |
| 62 | RequiredArgs args) { |
| 63 | return CGM.getTypes().arrangeLLVMFunctionInfo( |
Stephen Hines | 0e2c34f | 2015-03-23 12:09:02 -0700 | [diff] [blame] | 64 | returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes, |
Pirama Arumuga Nainar | 4967a71 | 2016-09-19 22:19:55 -0700 | [diff] [blame] | 65 | info, {}, args); |
Mark Lacey | 8b54999 | 2013-10-30 21:53:58 +0000 | [diff] [blame] | 66 | } |