C++ duchain unit tests

Milian Wolff mail at milianw.de
Thu Jun 17 21:27:36 UTC 2010


On Thursday 17 June 2010 23:07:22 Milian Wolff wrote:
> On Thursday 17 June 2010 22:55:51 Milian Wolff wrote:
> > On Thursday 17 June 2010 22:49:15 Milian Wolff wrote:
> > > On Thursday 17 June 2010 22:19:32 Milian Wolff wrote:
> > > > On Thursday 17 June 2010 21:42:31 Nicolás Alvarez wrote:
> > > > > On 6/17/10, Nicolás Alvarez <nicolas.alvarez at gmail.com> wrote:
> > > > > > I modified testDeclareUsingNamespace to dump duchain, and when
> > > > > > run alone, the foo::bar declaration indeed has zero uses; while
> > > > > > when run after testLocalNamespaceAlias, there is a
> > > > > > properly-ranged use.
> > > > 
> > > > Yep, can reproduce that.
> > > > 
> > > > > If I paste the test snippet in a normal C++ file, the 'bar' inside
> > > > > main() is underlined yellow. As soon as I type *anything* else
> > > > > (like adding a newline at the end), it's properly marked as a use.
> > > > > Pretty fragile stuff...
> > > > 
> > > > works for me :P Anyhow, since the above is reproducable I'll have a
> > > > look at it. Bye
> > > 
> > > The difference is in cppducontext.cpp:
> > > 
> > > in loc 234 in the conditional:
> > > 
> > > m_source != m_context
> > > 
> > > When running both tests one after the other, those pointers are equal.
> > > When running only one of them they are different...
> > 
> > false alarm,  either I'm blind or it's random :D
> 
> Well, the contexts _are_ different. But it works in one case since it
> somehow finds the declaration of the function bar() of the test before. If
> we change the testcase with different names it's broken in that case as
> well...

cppducontext.cpp -> loc 227 ( if( !scopeContext ) )

that does not find the declaration. It tries to prepend ::test() afterwards 
(the function contexts' identifier) but that doesn't find anything either of 
course... It would need to be ::foo::bar ...

Anyways, this shows another strange behavior, apparently 

    DUChain::self()->removeDocumentChain(m_top.data());

doesn't work properly... I get lots of messages like these:

QDEBUG : TestDUChain::testLocalNamespaceAlias() 
kdevplatform(30334)/kdevplatform (language)?[0;31m 
KDevelop::TopDUContextDynamicData::load?[0m: Cannot open top-context for 
reading: "/home/milian/.kdevduchain/{a5f36799-30e3-4983-9b94-
e9aa54f3849d}/0/topcontexts/2" 

Maybe that's related?
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100617/2c72ed80/attachment.sig>


More information about the KDevelop-devel mailing list