[kdev-clang] tests: Adapt unit test to the recent changes regarding environments.

Milian Wolff mail at milianw.de
Wed Aug 27 19:20:21 UTC 2014

On Wednesday 27 August 2014 20:07:34 Milian Wolff wrote:
> On Wednesday 27 August 2014 21:16:30 Sergey Kalinichev wrote:
> > 2. Also with it there are now many versions of contexts for the same
> > file with different environments and as a result in 90% cases we get
> > true on context->parsingEnvironmentFile()->needsUpdate() -> the whole
> > thing runs so slowly!

I've now added a unit test for that and confirmed the issue. Looking at it, 
the culprit was you though, sorry about that :)

Your change to introduce ClangEnvironmentFile::matchEnvironment is wrong, it 
checks too much and then we end up recreating a DUChain instead of reusing the 
old one in clangHelpers (i.e. DUChain::self()->chainForDocument returns 
nothing). There is a chain though, just with a different environment, it just 
doesn't get removed from memory.

I think you might have been completely confused due to a fault on my part. As 
I said in the previous mail, I did not push an essential change to 
kdevplatform which might have been the cause for you seeing so many reparses?

Anyhow, you wrote:

commit fccc9b4311abb8f858c18e80348df8d3e09b1ce3
Author: Sergey Kalinichev <kalinichev.so.0 at gmail.com>
Date:   Tue Aug 19 21:54:57 2014 +0400

    Implement ClangParsingEnvironmentFile::matchEnvironment
    Now code completion is so much faster!

Can you provide me with a benchmark? Or at least tell me where it is slow? 
This commit message alone does not tell me whats going on and why implementing 
::matchEnvironment (in the way you did) would improve the code completion 

See also: https://git.reviewboard.kde.org/r/119959/

Milian Wolff
mail at milianw.de

More information about the KDevelop-devel mailing list