Review Request: Declaration::hasUses fix

Aleix Pol Gonzalez aleixpol at gmail.com
Fri Jun 24 12:37:03 UTC 2011



> On June 24, 2011, 11:51 a.m., David Nolden wrote:
> > Hmm, this is extremely slow, the problem is the hasDeclarationUse function which iterates through all contexts. This is too slow for the way the function is supposed to be used, we need to find a better way.
> 
> David Nolden wrote:
>     Btw. I also don't like that the "hasLocalUse" etc. variables have been renamed to a meaningless "ret", why didn't you leave the variable-names alive? They make the code easier to understand.

Yes it's slow. If you have any idea how to make it work without looking them up, please tell me.

Regarding the ret, it's so that the code doesn't check every time  if it's in other contexts if it has been found already.


- Aleix


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/101722/#review4121
-----------------------------------------------------------


On June 22, 2011, 2:39 a.m., Aleix Pol Gonzalez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/101722/
> -----------------------------------------------------------
> 
> (Updated June 22, 2011, 2:39 a.m.)
> 
> 
> Review request for KDevelop.
> 
> 
> Summary
> -------
> 
> In cases like the following didn't return false, even though 'a' is not being used:
> 
> int f()
> {
>   QByteArray a;
> }
> 
> One would expect it to be a fast equivalent of !Declaration::uses().isEmpty(), but the result wasn't the same.
> This change is also removing some calls in DUChain::uses()->hasUses (in case there's already a use in the local context) which I guess it's useful as well.
> 
> I'm putting this on review because I'm not sure the correct way to fix it is checking if it's <0.
> 
> 
> Diffs
> -----
> 
>   language/duchain/declaration.cpp b3a7700 
> 
> Diff: http://git.reviewboard.kde.org/r/101722/diff
> 
> 
> Testing
> -------
> 
> I've played with some code with some scripts from my thesis.
> 
> 
> Thanks,
> 
> Aleix
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20110624/ebad6691/attachment.html>


More information about the KDevelop-devel mailing list