60
/** This constructor is to be used by classes inherited from
61
* CFunctionInfo. It makes it possible to set another object id
62
* than \c FUNCTION_INFO for abstractions not representing a
63
* standard function (e.g. CFctInstance).
64
* \param id The object id to be used instead of \c FUNCTION_INFO. */
59
* \param id The object type. */
65
60
CFunctionInfo (ObjectId id);
68
/** Construct a new function info. */
70
/** Destruct the function info. */
65
/** Destructor. If the object type is CObjectInfo::FUNCTION_INFO,
66
* then CObjectInfo::CleanUp() is called. */
73
// bool operator ==(const CFunctionInfo &) const;
75
/** Get the base info object of the info object. <b>The
76
* corresponding information is not yet set!</b>
77
* \return This method always returns \c NULL.
78
* \warning Do not use this method. */
79
CFunctionInfo *BaseObject () const;
80
/** Get the info object of the function definition.
81
* \return The info or \e this if the function is not defined. */
69
/** Get the semantic object of the function definition.
70
* \see CObjectInfo::DefObject() */
82
71
CFunctionInfo *DefObject () const;
83
/** Get the type information object for the function. */
72
/** Get the type information for the function. */
84
73
CTypeFunction *TypeInfo () const;
85
/** Return the conversion type if this is a conversion function.
86
* \return The conversion type or \c NULL if not a conversion function. */
74
/** Get the conversion type if this is a conversion function.
75
* \return The conversion type or NULL if not a conversion function. */
87
76
CTypeInfo *ConversionType () const;
88
/** Return the return type of the function. */
77
/** Get the return type of the function. */
89
78
CTypeInfo *ReturnType () const;
90
/** Get the template info if this is a function template.
91
* \return The template info or \c NULL if not a function template. */
79
/** Get the template information if this is a function template.
80
* \return The template information or NULL if not a function template. */
92
81
CTemplateInfo *TemplateInfo () const;
93
/** Return the class or union if this is method of a class or union.
94
* \return The record info or \c NULL if not a method. */
82
/** Get the class or union if this is a method of a class or union.
83
* \return The class/union or NULL if not a method. */
95
84
CRecord *Record () const;
96
/** Get the namespace info if this function is declared in a namespace.
97
* \return The namespace info or \c NULL if not declared in a namespace. */
85
/** Get the namespace if this function is declared in a namespace.
86
* \return The namespace or NULL if not declared in a namespace. */
98
87
CNamespaceInfo *Namespace () const;
102
89
/** Get the number of jump labels defined in the function body. */
103
90
unsigned Labels () const;
104
91
/** Get the number of function parameters. */
105
92
unsigned Arguments () const;
106
93
/** Get the n-th jump label.
107
* \param n The number of the jump label.
108
* \return The label info or \c NULL if \e n is invalid. */
94
* \param n The index of the jump label.
95
* \return The label or NULL if \e n is invalid. */
109
96
CLabelInfo *Label (unsigned n) const;
110
97
/** Get the jump label with the given name.
111
98
* \param name The name of the jump label.
112
* \return The label info or \c NULL if no such label. */
99
* \return The label or NULL if no such label. */
113
100
CLabelInfo *Label (const char *name) const;
114
101
/** Get the n-th function parameter.
115
* \param n The number of the function parameter.
116
* \return The function parameter info or \c NULL if \e n is invalid. */
102
* \param n The index of the function parameter.
103
* \return The function parameter or NULL if \e n is invalid. */
117
104
CArgumentInfo *Argument (unsigned n) const;
118
105
/** Get the function parameter with the given name.
119
106
* \param name The name of the function parameter.
120
* \return The function parameter info or \c NULL if no such parameter. */
107
* \return The function parameter or NULL if no such parameter. */
121
108
CArgumentInfo *Argument (const char *name) const;
122
109
/** Get the default argument of the n-th function parameter.
123
* \param The number of the function parameter.
110
* \param n The index of the function parameter.
124
111
* \return The syntax tree node of the default argument or
125
* \c NULL if the n-th parameter has no default argument. */
112
* NULL if the n-th parameter has no default argument. */
126
113
CTree *DefaultArgument (unsigned n) const;
127
114
/** Get the initializer of the function. Only pure virtual functions
128
* have an initializer, i.e. "=0".
129
* \return The syntax tree node of the initializer or \c NULL
115
* have an initializer ("=0").
116
* \return The syntax tree node of the initializer or NULL
130
117
* if function is not pure virtual. */
131
118
CT_ExprList *Init () const;
135
120
/** Set the conversion type of a conversion function.
136
121
* \param type The conversion type. */
137
122
void ConversionType (CTypeInfo *type);
139
124
* function declared in a namespace.
140
125
* \param scope The qualification scope. */
141
126
void QualifiedScope (CStructure *scope);
142
/** Add a function parameter to the function.
143
* \param info The function parameter info. */
127
/** Add a function parameter.
128
* \param info The function parameter. */
144
129
void addArgument (CArgumentInfo *info);
145
/** Add a jump label to the function.
146
* \param label The label info. */
130
/** Add a jump label.
131
* \param label The jump label. */
147
132
void addLabel (CLabelInfo *label);
148
/** Remove the given function parameter from the function.
149
* \param info The function parameter info. */
150
void removeArgument (const CArgumentInfo *);
151
/** Remove the given jump label from the function.
152
* \param label The label info. */
133
/** Remove the given function parameter.
134
* \param info The function parameter. */
135
void removeArgument (const CArgumentInfo *info);
136
/** Remove the given jump label.
137
* \param label The jump label. */
153
138
void removeLabel (const CLabelInfo *label);
154
/** Set the template info of a function template.
155
* \param info The template info. */
139
/** Set the template information of a function template.
140
* \param info The template information. */
156
141
void TemplateInfo (CTemplateInfo *info);
157
142
/** Set whether the function is a function template.
158
143
* \param v \c true if the function is a template. */
159
144
void isTemplate (bool v);
163
/** Create a new function parameter. The function parameter info
146
/** Create a new function parameter. The new function parameter
164
147
* is added to the function. */
165
148
CArgumentInfo *newArgument ();
166
/** Create a new jump label. The jump label info is added
149
/** Create a new jump label. The new jump label is added
167
150
* to the function. */
168
151
CLabelInfo *newLabel ();
169
152
/** Remove and destroy the given function parameter.
170
* \param info The function parameter info. */
153
* \param info The function parameter. */
171
154
void deleteArgument (const CArgumentInfo *info);
172
155
/** Remove and destroy the given jump label.
173
* \param info The jump label info. */
156
* \param info The jump label. */
174
157
void deleteLabel (const CLabelInfo *info);
176
// additional information
178
/** Return \e true if the function accepts a variable argument list. */
159
/** Check if the function accepts a variable argument list. */
179
160
bool hasEllipsis () const;
180
/** Return \e true if the n-th function parameter has a default argument.
181
* \param n The number of the function parameter. */
161
/** Check if the n-th function parameter has a default argument.
162
* \param n The index of the function parameter. */
182
163
bool hasDefaultArgument (unsigned n) const;
184
/** Return \e true if this is the info of a function definition. */
165
/** Check if this is a function definition. */
185
166
bool isFctDef () const;
186
/** Return \e true if this is a method of a class or union. */
167
/** Check if this is a method of a class or union. */
187
168
bool isMethod () const;
188
/** Return \e true if this is a static method of a class or union. */
169
/** Check if this is a static method of a class or union. */
189
170
bool isStaticMethod () const;
190
/** Return \e true if this is a function template. */
171
/** Check if this is a function template. */
191
172
bool isTemplate () const;
192
/** Return \e true if the function is defined. */
173
/** Check if the function is defined. */
193
174
bool isDefined () const;
194
/** Return \e true if this is a destructor. */
175
/** Check if this is a destructor. */
195
176
bool isDestructor () const;
196
/** Return \e true if this is a constructor. */
177
/** Check if this is a constructor. */
197
178
bool isConstructor () const;
198
/** Return \e true if this is an overloaded operator. */
179
/** Check if this is an overloaded operator. */
199
180
bool isOperator () const;
200
/** Return \e true if this is a conversion function. */
181
/** Check if this is a conversion function. */
201
182
bool isConversion () const;
183
/** Check if the function is pure virtual. */
184
bool isPureVirtual () const;
203
186
/** Set whether the function is a destructor.
204
187
* \param v \e true if the function is a destructor. */
213
196
* \param v \e true if the function is a conversion function. */
214
197
void isConversion (bool v);
216
// bool isRedefined () const;
217
/** Return \e true if the function is pure virtual. */
218
bool isPureVirtual () const;
220
/** Returns \e true if the argument function has the same name and
222
* \param fi function info object of the compared function. */
199
/** Check if the given function has the same name and
200
* parameter types as this function.
201
* \param fi The function to compare with. */
223
202
bool hasSameNameAndArgs (const CFunctionInfo *fi) const;
225
/** Returns \e true if the function is a non-static member function and
226
* if in any of the base classes there is a function definition of a
227
* virtual function with the same name and argument types */
204
/** Check if the function is a non-static member function and if
205
* in any of the base classes there is a function definition of a
206
* virtual function with the same name and argument types. */
228
207
bool overridesVirtual () const;