clang  3.7.0
CodeGenABITypes.cpp
Go to the documentation of this file.
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 
20 #include "CodeGenModule.h"
25 
26 using namespace clang;
27 using namespace CodeGen;
28 
30  llvm::Module &M,
31  const llvm::DataLayout &TD,
32  CoverageSourceInfo *CoverageInfo)
33  : CGO(new CodeGenOptions),
34  HSO(new HeaderSearchOptions),
35  PPO(new PreprocessorOptions),
36  CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO,
37  M, TD, C.getDiagnostics(),
38  CoverageInfo)) {
39 }
40 
42 {
43  delete CGO;
44  delete CGM;
45 }
46 
47 const CGFunctionInfo &
49  QualType receiverType) {
50  return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
51 }
52 
53 const CGFunctionInfo &
55  return CGM->getTypes().arrangeFreeFunctionType(Ty);
56 }
57 
58 const CGFunctionInfo &
60  return CGM->getTypes().arrangeFreeFunctionType(Ty);
61 }
62 
63 const CGFunctionInfo &
65  const FunctionProtoType *FTP) {
66  return CGM->getTypes().arrangeCXXMethodType(RD, FTP);
67 }
68 
69 const CGFunctionInfo &
71  ArrayRef<CanQualType> argTypes,
73  RequiredArgs args) {
74  return CGM->getTypes().arrangeLLVMFunctionInfo(
75  returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
76  info, args);
77 }
const CGFunctionInfo & arrangeFreeFunctionCall(CanQualType returnType, ArrayRef< CanQualType > argTypes, FunctionType::ExtInfo info, RequiredArgs args)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
const CGFunctionInfo & arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, QualType receiverType)
const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty)
Definition: CGCall.cpp:112
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:89
const CGFunctionInfo & arrangeLLVMFunctionInfo(CanQualType returnType, bool instanceMethod, bool chainCall, ArrayRef< CanQualType > argTypes, FunctionType::ExtInfo info, RequiredArgs args)
Definition: CGCall.cpp:485
const CGFunctionInfo & arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, QualType receiverType)
Definition: CGCall.cpp:295
const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty)
const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP)
Definition: CGCall.cpp:157
const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP)
CodeGenABITypes(ASTContext &C, llvm::Module &M, const llvm::DataLayout &TD, CoverageSourceInfo *CoverageInfo=nullptr)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285