]> granicus.if.org Git - clang/blob - lib/CodeGen/CGCall.h
Move FunctionType conversion into CGCall.cpp:
[clang] / lib / CodeGen / CGCall.h
1 //===----- CGCall.h - Encapsulate calling convention details ----*- C++ -*-===//
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 // These classes wrap the information about a call or function
11 // definition used to handle ABI compliancy.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef CLANG_CODEGEN_CGCALL_H
16 #define CLANG_CODEGEN_CGCALL_H
17
18 #include "clang/AST/Type.h"
19
20 #include "CGValue.h"
21
22 namespace llvm {
23   class Function;
24   struct ParamAttrsWithIndex;
25   class Value;
26
27   template<typename T, unsigned> class SmallVector;
28 }
29
30 namespace clang {
31   class ASTContext;
32   class Decl;
33   class FunctionDecl;
34   class ObjCMethodDecl;
35   class VarDecl;
36
37 namespace CodeGen {
38   typedef llvm::SmallVector<llvm::ParamAttrsWithIndex, 8> ParamAttrListType;
39
40   /// CallArgList - Type for representing both the value and type of
41   /// arguments in a call.
42   typedef llvm::SmallVector<std::pair<RValue, QualType>, 16> CallArgList;
43
44   /// FunctionArgList - Type for representing both the decl and type
45   /// of parameters to a function. The decl must be either a
46   /// ParmVarDecl or ImplicitParamDecl.
47   typedef llvm::SmallVector<std::pair<const VarDecl*, QualType>, 
48                             16> FunctionArgList;
49   
50   // FIXME: This should be a better iterator type so that we can avoid
51   // construction of the ArgTypes smallvectors.
52   typedef llvm::SmallVector<QualType, 16>::const_iterator ArgTypeIterator;
53
54   /// CGFunctionInfo - Class to encapsulate the information about a
55   /// function definition.
56   class CGFunctionInfo {
57     bool IsVariadic;
58
59     llvm::SmallVector<QualType, 16> ArgTypes;
60
61   public:
62     CGFunctionInfo(const FunctionTypeNoProto *FTNP);
63     CGFunctionInfo(const FunctionTypeProto *FTP);
64     CGFunctionInfo(const FunctionDecl *FD);
65     CGFunctionInfo(const ObjCMethodDecl *MD,
66                    const ASTContext &Context);
67
68     bool isVariadic() const { return IsVariadic; }
69
70     ArgTypeIterator argtypes_begin() const;
71     ArgTypeIterator argtypes_end() const;
72   };
73
74   /// CGCallInfo - Class to encapsulate the arguments and clang types
75   /// used in a call.
76   class CGCallInfo {
77     llvm::SmallVector<QualType, 16> ArgTypes;
78
79   public:
80     CGCallInfo(QualType _ResultType, const CallArgList &Args);
81
82     ArgTypeIterator argtypes_begin() const;
83     ArgTypeIterator argtypes_end() const;
84   };
85 }  // end namespace CodeGen
86 }  // end namespace clang
87
88 #endif