clang  3.8.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  CoverageSourceInfo *CoverageInfo)
31  : CGO(new CodeGenOptions), HSO(new HeaderSearchOptions),
32  PPO(new PreprocessorOptions),
33  CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO, M, C.getDiagnostics(),
34  CoverageInfo)) {}
35 
36 // Explicitly out-of-line because ~CodeGenModule() is private but
37 // CodeGenABITypes.h is part of clang's API.
39 
40 const CGFunctionInfo &
42  QualType receiverType) {
43  return CGM->getTypes().arrangeObjCMessageSendSignature(MD, receiverType);
44 }
45 
46 const CGFunctionInfo &
48  const FunctionDecl *FD) {
49  return CGM->getTypes().arrangeFreeFunctionType(Ty, FD);
50 }
51 
52 const CGFunctionInfo &
54  return CGM->getTypes().arrangeFreeFunctionType(Ty);
55 }
56 
57 const CGFunctionInfo &
59  const FunctionProtoType *FTP,
60  const CXXMethodDecl *MD) {
61  return CGM->getTypes().arrangeCXXMethodType(RD, FTP, MD);
62 }
63 
65  CanQualType returnType, ArrayRef<CanQualType> argTypes,
67  return CGM->getTypes().arrangeLLVMFunctionInfo(
68  returnType, /*IsInstanceMethod=*/false, /*IsChainCall=*/false, argTypes,
69  info, args);
70 }
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1483
A (possibly-)qualified type.
Definition: Type.h:575
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)
These methods all forward to methods in the private implementation class CodeGenTypes.
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:91
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3041
A class for recording the number of arguments that a function signature requires. ...
CodeGenABITypes(ASTContext &C, llvm::Module &M, CoverageSourceInfo *CoverageInfo=nullptr)
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1701
CGFunctionInfo - Class to encapsulate the information about a function definition.
This class organizes the cross-function state that is used while generating LLVM code.
const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP, const CXXMethodDecl *MD)
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
HeaderSearchOptions - Helper class for storing options related to the initialization of the HeaderSea...
const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty, const FunctionDecl *FD)
A class which abstracts out some details necessary for making a call.
Definition: Type.h:2872