swift
828de17b - [Macros] Resolve macro names using unqualified lookup that ignores expansions

Commit
2 years ago
[Macros] Resolve macro names using unqualified lookup that ignores expansions The macro name resolution in the source lookup cache was only looking at macros in the current module, meaning that any names introduced by peer or declaration macros declared in one module but used in another would not be found by name lookup. Switch the source lookup cache over to using the same `forEachPotentialResolvedMacro` API that is used by lookup within types, so we have consistent name-lookup-level macro resolution in both places. ... except that would be horribly cyclic, of course, so introduce name lookup flags to ignore top-level declarations introduced by macro expansions. This is semantically correct because macro expansions are not allowed to introduce new macros anyway, because that would have been a terrible idea. Fixes rdar://107321469. Peer and declaration macros at module scope should work a whole lot better now.
Author
Parents
  • include/swift
    • AST
      • File
        FileUnit.h
      • File
        LookupKinds.h
      • File
        Module.h
      • File
        NameLookup.h
      • File
        SourceFile.h
      • File
        SynthesizedFileUnit.h
    • ClangImporter
      • File
        ClangModule.h
    • Serialization
      • File
        SerializedModuleLoader.h
  • lib
    • AST
      • File
        ASTContext.cpp
      • File
        Module.cpp
      • File
        ModuleNameLookup.cpp
      • File
        NameLookup.cpp
      • File
        UnqualifiedLookup.cpp
    • ClangImporter
      • File
        ClangImporter.cpp
      • File
        DWARFImporter.cpp
    • Serialization
      • File
        SerializedModuleLoader.cpp
  • test/Macros
    • Inputs
      • File
        macro_library.swift
    • File
      macro_expand_peers.swift