clang API Documentation

CodeGenABITypes.h
Go to the documentation of this file.
00001 //==---- CodeGenABITypes.h - 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 // It allows other clients, like LLDB, to determine the LLVM types that are
00018 // actually used in function calls, which makes it possible to then determine
00019 // the acutal ABI locations (e.g. registers, stack locations, etc.) that
00020 // these parameters are stored in.
00021 //
00022 //===----------------------------------------------------------------------===//
00023 
00024 #ifndef LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
00025 #define LLVM_CLANG_CODEGEN_CODEGENABITYPES_H
00026 
00027 #include "clang/AST/CanonicalType.h"
00028 #include "clang/AST/Type.h"
00029 #include "clang/CodeGen/CGFunctionInfo.h"
00030 
00031 namespace llvm {
00032   class DataLayout;
00033   class Module;
00034 }
00035 
00036 namespace clang {
00037 class ASTContext;
00038 class CXXRecordDecl;
00039 class CodeGenOptions;
00040 class DiagnosticsEngine;
00041 class ObjCMethodDecl;
00042 class CoverageSourceInfo;
00043 
00044 namespace CodeGen {
00045 class CGFunctionInfo;
00046 class CodeGenModule;
00047 
00048 class CodeGenABITypes
00049 {
00050 public:
00051   CodeGenABITypes(ASTContext &C, llvm::Module &M, const llvm::DataLayout &TD,
00052                   CoverageSourceInfo *CoverageInfo = nullptr);
00053   ~CodeGenABITypes();
00054 
00055   /// These methods all forward to methods in the private implementation class
00056   /// CodeGenTypes.
00057 
00058   const CGFunctionInfo &arrangeObjCMessageSendSignature(
00059                                                      const ObjCMethodDecl *MD,
00060                                                      QualType receiverType);
00061   const CGFunctionInfo &arrangeFreeFunctionType(
00062                                                CanQual<FunctionProtoType> Ty);
00063   const CGFunctionInfo &arrangeFreeFunctionType(
00064                                              CanQual<FunctionNoProtoType> Ty);
00065   const CGFunctionInfo &arrangeCXXMethodType(const CXXRecordDecl *RD,
00066                                              const FunctionProtoType *FTP);
00067   const CGFunctionInfo &arrangeFreeFunctionCall(CanQualType returnType,
00068                                                 ArrayRef<CanQualType> argTypes,
00069                                                 FunctionType::ExtInfo info,
00070                                                 RequiredArgs args);
00071 
00072 private:
00073   /// Default CodeGenOptions object used to initialize the
00074   /// CodeGenModule and otherwise not used. More specifically, it is
00075   /// not used in ABI type generation, so none of the options matter.
00076   CodeGenOptions *CGO;
00077 
00078   /// The CodeGenModule we use get to the CodeGenTypes object.
00079   CodeGen::CodeGenModule *CGM;
00080 };
00081 
00082 }  // end namespace CodeGen
00083 }  // end namespace clang
00084 
00085 #endif