Review Request: Declaration::hasUses fix

Aleix Pol Gonzalez aleixpol at gmail.com
Wed Jun 22 02:39:57 UTC 2011


-----------------------------------------------------------
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.


Changes
-------

It was not checking if the declaration is actually being used in the current file in case the declaration is from the same TopDUContext. In this case, find it recursively.

I don't know any other way to do so...


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 (updated)
-----

  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/20110622/1130db7b/attachment.html>


More information about the KDevelop-devel mailing list