<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 23, 2015, at 14:15 , Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 23, 2015 at 10:53 AM, Jordan Rose <span dir="ltr" class=""><<a href="mailto:jordan_rose@apple.com" target="_blank" class="">jordan_rose@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi, Richard. Thanks for all your improvements to modules this year! I just filed <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23929&d=AwMFAg&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=JeeYCCgheo_KEL2ITXqXbVWLHrKtiwf0VRZ_51i01IQ&s=AEEh3si3pHG1I_oFWTs2eWWITxkvpdQsD0JzzewGn-8&e=" target="_blank" class="">PR23929</a>, 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.</div></blockquote><div class=""><br class=""></div><div class="">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.)</div><div class=""><br class=""></div><div class="">I think this should be a straightforward fix; if you have problems, let me know and I'll tackle it. Sorry for breaking you :-)</div></div></div></div></div></blockquote><br class=""></div><div>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?</div><div><br class=""></div><div>Jordan</div><div><br class=""></div><div></div></body></html>