Infinite recursion in DUContext::findDeclarationsInternal

David nolden david.nolden.kdevelop at art-master.de
Tue Jan 27 23:33:11 UTC 2009


Am Mittwoch 28 Januar 2009 00:24:12 schrieb Milian Wolff:
> Hi guys!
>
> I'm having a bit of a problem while developing the PHP plugin. Take this
> code:
>
> ~~~
> class a extends b {}
> class b extends c {}
> class c extends a {}
> ~~~
>
> Internally this gets parsed twice to get all declarations. The
> DeclarationBuilder works fine, but the second UseBuilder segfaults because
> it uses findDeclarations which goes into findDeclarationsInternal and
> segfaults then, backtrace shows an infinite recursion in ducontext.cpp:833
> if I remember correctly.
>
> I'm not sure how I should handle that:
>
> 1) Do I have to adapt the DeclarationBuilder to make sure it does not
> introduce circular inheritance?
> 2) Do I have to write a cleanup/validation function which looks for
> circular inheritance and filters those?
> 3) Do I have to adapt the UseBuilder?
> 4) Something other than that?

It depends on the language. Is that circular inheritance in some way valid 
php? If not, then you have to prevent the circular inheritance in the context-
builder. That's how C++ does it. Only call context->addImport(othercontext), 
if not othercontext->imports(context).

Greetings, David








More information about the KDevelop-devel mailing list