[cfe-commits] patch: simplify and fix LookupVisibleDecls

Nick Lewycky nlewycky at google.com
Fri Mar 23 22:12:38 PDT 2012

LookupVisibleDecls does redundant work which was caught by my new assertion
(see PR12339) but upon further investigation we found that it's also buggy
in some cases. Two new testcases are included.

The attached patch works by adding a new iterator on DeclContext which
exposes all decls that would be visible through DC->lookup() as an
iterator, then LookupVisibleDecls just iterates through those. The fix also
allows us to delete some code in code completion.

There is one form of fallout which I don't understand, and I need review
for this. In one Objective-C test, the autocomplete priority changed from
37 to 35. It's not clear to me whether that's a bug fixed or a bug
introduced, and I'd appreciate some help understanding why prop4 should
have been getting the 2-point penalty in test/Index/complete-synthesized.m
(and not, say, prop2 which actually is in the base class). It looks from
the commit log like that number might not actually be important.

Please review! This patch has Richard Smith approval, subject to the change
to the objective-c tests being approved by somebody else.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120323/778c53f7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr12339-2.patch
Type: application/octet-stream
Size: 9400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120323/778c53f7/attachment.obj>

More information about the cfe-commits mailing list