171
171
CObjectInfo *o = (CObjectInfo*)this;
173
173
if (o->Tree () && o->Tree ()->NodeName () == CT_FctDef::NodeId ())
174
if (! (o->TemplateInstance () && o->TemplateInstance ()->isPseudoInstance ()))
174
if (! o->TemplateInstance () || o->TemplateInstance ()->canInstantiate ())
175
175
return o->FunctionInfo ();
176
176
o = o->NextObject ();
177
177
} while (o != (CObjectInfo*)this);
210
210
// first the names are compared
211
211
if (Name () != fi->Name ())
214
214
// now the argument types are checked
215
215
CTypeList *my_types = TypeInfo ()->TypeFunction ()->ArgTypes ();
216
216
CTypeList *other_types = fi->TypeInfo ()->TypeFunction ()->ArgTypes ();
228
228
// the function has to be a non-static member function
229
229
if (!isMethod () || isStaticMethod ())
232
232
CClassInfo *cls = TypeInfo ()->TypeFunction ()->Record ()->ClassInfo ();
233
233
return cls->overridesVirtual (this);
236
/** Check if this is a default constructor. */
237
bool CFunctionInfo::isDefaultConstructor () const {
239
// A default constructor for a class X is a constructor of class X
240
// that can be called without an argument.
241
if (! isConstructor ())
243
// check the parameters
244
for (unsigned i = 0; i < Arguments (); i++)
245
if (! Argument (i)->hasDefaultArg ())
250
/** Check if this is a copy constructor. */
251
bool CFunctionInfo::isCopyConstructor () const {
253
// A non-template constructor for class X is a copy constructor if its
254
// first parameter is of type X&, const X&, volatile X& or const volatile X&,
255
// and either there are no other parameters or else all other parameters have
256
// default arguments.
257
if (! isConstructor () || isTemplate () || Arguments () == 0)
261
CRecord* c = Record ();
265
// check first parameter
266
CTypeInfo* arg = Argument ((unsigned)0)->TypeInfo ();
267
if (! arg->isAddress () ||
268
! arg->isClassOrUnion () ||
269
*arg->VirtualType ()->TypeRecord () != *c->TypeInfo ())
272
// check the other parameters
273
for (unsigned i = 1; i < Arguments (); i++)
274
if (! Argument (i)->hasDefaultArg ())
279
/** Check if this is a copy assignment operator. */
280
bool CFunctionInfo::isCopyAssignOperator () const {
282
// A copy assignment operator X::operator= is a non-static non-template
283
// member function of class X with exactly one parameter of type X, X&,
284
// const X&, volatile X& or const volatile X&.
285
if (! isOperator () || isStatic () || isTemplate () || Arguments () != 1)
288
// assignment operator
289
if (Name ().c_str () && strcmp (Name ().c_str (), "operator =") != 0)
293
CRecord* c = Record ();
298
CTypeInfo* arg = Argument ((unsigned)0)->TypeInfo ();
299
if (! arg->isClassOrUnion ())
301
if (arg->isAddress () && *arg->VirtualType ()->TypeRecord () == *c->TypeInfo ())
303
if (arg->TypeRecord () && *arg->TypeRecord () == *c->TypeInfo ())
236
308
} // namespace Puma