clang  3.8.0
CodeGenABITypes.h
Go to the documentation of this file.
1 //==---- CodeGenABITypes.h - 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 // It allows other clients, like LLDB, to determine the LLVM types that are
18 // actually used in function calls, which makes it possible to then determine
19 // the acutal ABI locations (e.g. registers, stack locations, etc.) that
20 // these parameters are stored in.
21 //
22 //===----------------------------------------------------------------------===//
23 
24 #ifndef LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
25 #define LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
26 
28 #include "clang/AST/Type.h"
30 
31 namespace llvm {
32  class DataLayout;
33  class Module;
34 }
35 
36 namespace clang {
37 class ASTContext;
38 class CXXRecordDecl;
39 class CXXMethodDecl;
40 class CodeGenOptions;
41 class CoverageSourceInfo;
42 class DiagnosticsEngine;
43 class HeaderSearchOptions;
44 class ObjCMethodDecl;
45 class PreprocessorOptions;
46 
47 namespace CodeGen {
48 class CGFunctionInfo;
49 class CodeGenModule;
50 
52 {
53 public:
54  CodeGenABITypes(ASTContext &C, llvm::Module &M,
55  CoverageSourceInfo *CoverageInfo = nullptr);
57 
58  /// These methods all forward to methods in the private implementation class
59  /// CodeGenTypes.
60 
62  const ObjCMethodDecl *MD,
63  QualType receiverType);
65  const FunctionDecl *FD);
69  const FunctionProtoType *FTP,
70  const CXXMethodDecl *MD);
72  ArrayRef<CanQualType> argTypes,
74  RequiredArgs args);
75 
76 private:
77  /// Default CodeGenOptions object used to initialize the
78  /// CodeGenModule and otherwise not used. More specifically, it is
79  /// not used in ABI type generation, so none of the options matter.
80  std::unique_ptr<CodeGenOptions> CGO;
81  std::unique_ptr<HeaderSearchOptions> HSO;
82  std::unique_ptr<PreprocessorOptions> PPO;
83 
84  /// The CodeGenModule we use get to the CodeGenTypes object.
85  std::unique_ptr<CodeGen::CodeGenModule> CGM;
86 };
87 
88 } // end namespace CodeGen
89 } // end namespace clang
90 
91 #endif
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
C Language Family Type Representation.
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.
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
friend class ASTContext
Definition: Type.h:4012
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.
const CGFunctionInfo & arrangeCXXMethodType(const CXXRecordDecl *RD, const FunctionProtoType *FTP, const CXXMethodDecl *MD)
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
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