Commit Graph

112 Commits

Author SHA1 Message Date
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
Varun Gandhi
65577940d0 [NFC] Get rid of -Wrange-loop-analysis warnings. (#31324) 2020-04-27 09:47:52 -07:00
Anthony Latsis
74252028ca AST: Rename getFullName -> getName on ValueDecl & MissingMemberDecl 2020-04-23 05:16:55 +03:00
Brent Royal-Gordon
f38474896d Fix layering of cross-import and clang overlays
If a clang module declares a cross-import overlay, but it also has a traditional overlay, we want the cross-import overlay to be registered with the SourceFile as sitting atop the traditional overlay. Otherwise module-qualified name lookups will bypass the cross-import overlay.

Fixes rdar://62139656.
2020-04-21 23:43:53 -07:00
Hamish Knight
813c0d663f Move import warning silencing logic
Move the warning suppression code from the
frontend and into import resolution. Parsing
already has its own logic for silencing warnings.
2020-04-20 19:48:36 -07:00
Hamish Knight
92103a7c63 [AST] Remove SourceFile::addImports
Temporarily replace with `SourceFile::setImports`
until import resolution is requestified. Now
imports are only set once for a given SourceFile.

Because we're now asserting in more places that
import resolution must have run before querying
imports, this commit also adds
`getCachedUnderlyingType` to TypeAliasDecl to stop
the ASTDumper from trying to query imports for a
-dump-parse invocation.
2020-04-20 13:20:35 -07:00
Hamish Knight
b500f371fe [Sema] Don't skip import resolution for empty file
The associated comment appears to outdated. Make
sure we continue to record implicit imports for
empty files.
2020-04-20 13:20:35 -07:00
Hamish Knight
7f8a0e8a6c Requestify implicit imports
Add ModuleImplicitImportsRequest, which computes
the modules that should be implicitly imported by
each file of a given module. Use this request in
import resolution to add all the necessary
implicit imports.

The request computes the implicit imports by
consulting the ImplicitImportInfo, which ModuleDecl
can now be created with. This allows us to remove
uses of `SourceFile::addImports` in favor of
adding modules needed to be implicitly imported to
the ImplicitImportInfo.
2020-04-20 13:20:35 -07:00
Brent Royal-Gordon
4de19e1c3c Merge pull request #30819 from brentdax/a-less-ambitious-crossover-event
Ignore transitive ObjC imports when cross-importing
2020-04-08 11:40:35 -07:00
Brent Royal-Gordon
121fa9a058 Ignore transitive ObjC imports when cross-importing
This behavior change reduces the chance of unexpected and unwanted cross-imports being performed.

Fixes rdar://problem/60554019.
2020-04-05 19:06:59 -07:00
Artem Chikin
b679fd8738 Add -Rcross-import option
It is an optional, user-accessible mechanism to have the compiler tell you what it’s cross-importing.

Resolves rdar://problem/60381893
2020-04-02 19:45:39 -07:00
Hamish Knight
d2434e1bf7 NFC: Rename NameBinding to ImportResolution 2020-03-29 18:43:58 -07:00