clang API Documentation
00001 //==--- CodeGenABITypes.cpp - Convert Clang types to LLVM types for ABI ----==// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // CodeGenABITypes is a simple interface for getting LLVM types for 00011 // the parameters and the return value of a function given the Clang 00012 // types. 00013 // 00014 // The class is implemented as a public wrapper around the private 00015 // CodeGenTypes class in lib/CodeGen. 00016 // 00017 //===----------------------------------------------------------------------===// 00018 00019 #include "clang/CodeGen/CodeGenABITypes.h" 00020 #include "CodeGenModule.h" 00021 #include "clang/CodeGen/CGFunctionInfo.h" 00022 #include "clang/Frontend/CodeGenOptions.h" 00023 00024 using namespace clang; 00025 using namespace CodeGen; 00026 00027 CodeGenABITypes::CodeGenABITypes(ASTContext &C, 00028 llvm::Module &M, 00029 const llvm::DataLayout &TD, 00030 CoverageSourceInfo *CoverageInfo) 00031 : CGO(new CodeGenOptions), 00032 CGM(new CodeGen::CodeGenModule(C, *CGO, M, TD, C.getDiagnostics(), 00033 CoverageInfo)) { 00034 } 00035 00036 CodeGenABITypes::~CodeGenABITypes() 00037 { 00038 delete CGO; 00039 delete CGM; 00040 } 00041 00042 const CGFunctionInfo & 00043 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, 00044 QualType receiverType) { 00045 return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType); 00046 } 00047 00048 const CGFunctionInfo & 00049 CodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionProtoType> Ty) { 00050 return CGM->getTypes().arrangeFreeFunctionType(Ty); 00051 } 00052 00053 const CGFunctionInfo & 00054 CodeGenABITypes::arrangeFreeFunctionType(CanQual<FunctionNoProtoType> Ty) { 00055 return CGM->getTypes().arrangeFreeFunctionType(Ty); 00056 } 00057 00058 const CGFunctionInfo & 00059 CodeGenABITypes::arrangeCXXMethodType(const CXXRecordDecl *RD, 00060 const FunctionProtoType *FTP) { 00061 return CGM->getTypes().arrangeCXXMethodType(RD, FTP); 00062 } 00063 00064 const CGFunctionInfo & 00065 CodeGenABITypes::arrangeFreeFunctionCall(CanQualType returnType, 00066 ArrayRef<CanQualType> argTypes, 00067 FunctionType::ExtInfo info, 00068 RequiredArgs args) { 00069 return CGM->getTypes().arrangeLLVMFunctionInfo( 00070 returnType, /*IsInstanceMethod=*/false, argTypes, info, args); 00071 }