[cfe-dev] PR23929 - Code completion for macros broken when modules enabled

Jordan Rose jordan_rose at apple.com
Wed Jun 24 09:59:57 PDT 2015

> On Jun 23, 2015, at 14:15 , Richard Smith <richard at metafoo.co.uk> wrote:
> On Tue, Jun 23, 2015 at 10:53 AM, Jordan Rose <jordan_rose at apple.com <mailto:jordan_rose at apple.com>> wrote:
> Hi, Richard. Thanks for all your improvements to modules this year! I just filed PR23929 <https://llvm.org/bugs/show_bug.cgi?id=23929>, which shows how code completion is no longer finding macros that come from modules. Any idea what should be changed here? If you don't have time to fix this I'm happy to be the one who actually codes it up, but at the moment I'm not even quite sure what piece is missing.
> Identifiers that have macro names imported from modules get lazily updated, and macro_begin isn't triggering enough updating to produce a complete map. The easiest thing to do would be to walk the ModuleMacros map from within macro_begin, and add entries for each identifier with any module macros to the MacroMap in the CurSubmoduleState. (Alternatively, you could change macro_begin/macro_end to return iterators over the identifier table that filter out non-macro identifiers. Either way is a little wasteful, but avoiding that waste would require implementing a rather fancy iterator, which seems like overkill for this problem.)
> I think this should be a straightforward fix; if you have problems, let me know and I'll tackle it. Sorry for breaking you :-)

Ah, you're right, it was that simple. How does the attached patch look? Do you think I need to beef up the tests to account for visible vs. non-visible modules, or do you think this is fine to commit as is?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150624/53493319/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: macros.patch
Type: application/octet-stream
Size: 2086 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150624/53493319/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150624/53493319/attachment-0001.html>

More information about the cfe-dev mailing list