Commit Graph

498 Commits

Author SHA1 Message Date
Robert Widmann
de72824b04 [Gardening] Canonicalize usages of ASTContext::Stats 2020-02-27 17:12:58 -08:00
Hamish Knight
d9182af63d [AST] Introduce ModuleDecl::getTopLevelModule
This can be used to retrieve the Swift module
wrapper for a Clang submodule's top-level module.
2020-02-24 20:10:13 -08:00
Alexis Laferrière
0e7029dfb5 Use "SPI group" for the name used in an @_spi attribute 2020-02-19 14:18:11 -08:00
Alexis Laferrière
2e73cb44fd [Sema] Type-check the use and exposability of SPI decls 2020-02-19 14:17:14 -08:00
Alexis Laferrière
501f458879 [AST] Intro service lookupImportedSPIs to find direct SPI imports of a module 2020-02-19 14:17:14 -08:00
Alexis Laferrière
d5969a9f3a [AST] Intro SPI attribute for access control and imports 2020-02-19 14:17:08 -08:00
Brent Royal-Gordon
9adaddc611 [NFC] Additional readability improvements
Courtesy of Varun.
2020-02-19 01:00:41 -08:00
Brent Royal-Gordon
12286197c9 [NFC] Improvements suggested in code review
Thank you, @hamishknight and @varungandhi-apple.
2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
d6bccba9b6 Load cross-import overlays 2020-02-18 11:08:36 -08:00
Brent Royal-Gordon
f8df2f66fd Add mechanism for per-SourceFile overlays
When a “separately imported overlay” is added to a SourceFile, two things happen:

1. The direct import of the underlying module is removed from getImports*() by default. It is only visible if the caller passes ImportFilterKind:: ShadowedBySeparateOverlay. This means that non-module-scoped lookups will search _OverlayModule before searching its re-export UnderlyingModule, allowing it to shadow underlying declarations.

2. When you ask for lookupInModule() to look in the underlying module in that source file, it looks in the overlays instead. This means that UnderlyingModule.foo() can find declarations in _OverlayModule.
2020-02-18 11:07:12 -08:00
Brent Royal-Gordon
e248f82773 Add support for loading cross-import files 2020-02-18 11:06:12 -08:00
Slava Pestov
0555de5469 Sema: Remove a couple of calls to clearLookupCache()
Tests seem to pass without these.

Two calls still remain, in ModuleDecl::addFiles() and removeFiles().
It will take a bit more refactoring to eliminate those.
2020-02-17 21:49:02 -05:00
Hamish Knight
2e40295640 NFC: Extract simple_display for FileUnit 2020-02-13 20:44:38 -08:00
Robert Widmann
054d7b9913 Merge pull request #29713 from CodaFi/unused-unwanted-unloved
[Gardening] Silence Some Warning Spew
2020-02-11 15:46:16 -08:00
Robert Widmann
3bd0044143 [Gardening] Remove remaining casting artifacts 2020-02-07 16:09:31 -08:00
Arnold Schwaighofer
43c24be5cd Merge remote-tracking branch 'upstream/master' into master-next 2020-01-08 06:41:34 -08:00
Robert Widmann
19f0d52eca Merge pull request #28995 from CodaFi/absolutely-path-ological
[NFC] Hide SourceFile::Decls
2020-01-06 18:48:55 -08:00
Robert Widmann
96b3b9f0f4 [NFC] Hide SourceFile::Decls
In preparation for installing some stable paths infrastructure here,
hide access to the array of top-level decls.
2020-01-03 14:14:00 -08:00
Kita, Maksim
ea6a2dc094 SR-11889: Fixed code review issues
1. Updated Located field names with Pascal Case
2. Updated Located constuctor
3. Formatted lines with more than 80 symbols
2019-12-20 17:18:59 +03:00
Kita, Maksim
b7cb3b67bf SR-11889: Using Located<T> instead of std::pair<SourceLoc, T> 2019-12-20 17:18:58 +03:00
Joe Groff
fb34044408 Merge remote-tracking branch 'origin/master' into master-next 2019-12-10 12:46:41 -08:00
Alexis Laferrière
e9abba2eab [Serialization] Filter Decl to deserialize by their attributes
Add an alternative to getTopLevelDecls and getDeclChecked to limit which
decls are deserialized by first looking at their attributes. If the
attributes are accepted by a function passed as argument the decl is
fully deserialized, otherwise it is ignored.

The filter is included in the signature of existing functions in the
Serilalization services, but I’ve added new methods for it in FileUnit
and its subclasses to leave existing implementations untouched.
2019-11-21 10:06:37 -08:00
swift-ci
36da3cab70 Merge remote-tracking branch 'origin/master' into master-next 2019-10-30 16:49:48 -07:00
Robert Widmann
4996858c4d Re-implement isInvalid for ValueDecls 2019-10-30 15:09:14 -07:00
swift-ci
2689ff9343 Merge remote-tracking branch 'origin/master' into master-next 2019-10-30 07:49:45 -07:00
Robert Widmann
b849e51768 Use operator bool to claw back some readability 2019-10-29 16:56:21 -07:00
Robert Widmann
3e1a61f425 [NFC] Fold The Tri-State In Optional<ProtocolConformanceRef>
ProtocolConformanceRef already has an invalid state.  Drop all of the
uses of Optional<ProtocolConformanceRef> and just use
ProtocolConformanceRef::forInvalid() to represent it.  Mechanically
translate all of the callers and callsites to use this new
representation.
2019-10-29 16:55:56 -07:00
swift-ci
71e9fc221b Merge remote-tracking branch 'origin/master' into master-next 2019-10-11 22:09:52 -07:00
Slava Pestov
2e558f8c89 Merge pull request #27594 from slavapestov/circular-validation-cleanups-6
Circular validation cleanups, part 6
2019-10-12 00:59:21 -04:00
swift-ci
4950d131b2 Merge remote-tracking branch 'origin/master' into master-next 2019-10-10 17:29:58 -07:00
Jordan Rose
171ff440fc Remove swift::reversed in favor of llvm::reverse (#27610)
The former predates the latter, but we don't need it anymore! The
latter has more features anyway.

No functionality change.
2019-10-10 17:16:09 -07:00
Slava Pestov
6974448b1e Sema: Fold TypeAliasDecl::computeType() into validateDecl() 2019-10-10 19:55:02 -04:00
swift-ci
84f192ddce Merge remote-tracking branch 'origin/master' into master-next 2019-10-10 13:50:08 -07:00
Xi Ge
483bd5dbc3 SerializeLoc: implement SourceFile::getBasicLocsForDecl()
After having this function, the serialization logic doesn't have to
know where the source locations are coming from (.swift or .swiftmodule).
2019-10-09 17:30:34 -07:00
swift-ci
d410fb848d Merge remote-tracking branch 'origin/master' into master-next 2019-10-07 22:09:16 -07:00
Slava Pestov
cdcb8e4f0f AST: Lazier opaque type validation 2019-10-04 22:11:07 -04:00
swift-ci
31004db03c Merge remote-tracking branch 'origin/master' into master-next 2019-10-03 18:29:24 -07:00
Slava Pestov
6702d38d87 Sema: Remove most calls to Decl::setValidationToChecked() 2019-10-03 17:11:45 -04:00
swift-ci
388697b23c Merge remote-tracking branch 'origin/master' into master-next 2019-09-23 22:50:12 -07:00
Robert Widmann
ed18f47d05 Port getInterfaceType() patterns in libAST 2019-09-23 16:49:09 -07:00
swift-ci
8ce5b01307 Merge remote-tracking branch 'origin/master' into master-next 2019-09-18 15:09:47 -07:00
Robert Widmann
38bde33067 Merge pull request #27172 from CodaFi/aliasing-artifacts-and-noise-reduction-techniques
Kill validateDeclForNameLookup Harder
2019-09-18 15:00:51 -07:00
swift-ci
a453eda2dc Merge remote-tracking branch 'origin/master' into master-next 2019-09-18 10:09:53 -07:00
Jordan Rose
8d7f1b7c5d [AST] Separate SourceFile from FileUnit.h
Like the last commit, SourceFile is used a lot by Parse and Sema, but
less so by the ClangImporter and (de)Serialization. Split it out to
cut down on recompilation times when something changes.

This commit does /not/ split the implementation of SourceFile out of
Module.cpp, which is where most of it lives. That might also be a
reasonable change, but the reason I was reluctant to is because a
number of SourceFile members correspond to the entry points in
ModuleDecl. Someone else can pick this up later if they decide it's a
good idea.

No functionality change.
2019-09-17 17:54:41 -07:00
Jordan Rose
853caa66d4 [AST] Split FileUnit and its subclasses out of Module.h
Most of AST, Parse, and Sema deal with FileUnits regularly, but SIL
and IRGen certainly don't. Split FileUnit out into its own header to
cut down on recompilation times when something changes.

No functionality change.
2019-09-17 17:54:41 -07:00
Robert Widmann
5e34169aca Separate computing interface types and underlying types
Computing the interface type of a typealias used to push validation forward and recompute the interface type on the fly.  This was fragile and inconsistent with the way interface types are computed in the rest of the decls.  Separate these two notions, and plumb through explicit interface type computations with the same "computeType" idiom.  This will better allow us to identify the places where we have to force an interface type computation.

Also remove access to the underlying type loc.  It's now just a cache location the underlying type request will use.  Push a type repr accessor to the places that need it, and push the underlying type accessor for everywhere else.  Getting the structural type is still preferred for pre-validated computations.

This required the resetting of a number of places where we were - in many cases tacitly - asking the question "does the interface type exist".  This enables the removal of validateDeclForNameLookup
2019-09-17 08:20:55 -07:00
swift-ci
c30fcd3e88 Merge remote-tracking branch 'origin/master' into master-next 2019-09-14 18:49:28 -07:00
David Ungar
c7e603ddf7 Fix overly restrictive assertion, for -dump-scope-maps case 2019-09-14 13:41:59 -07:00
David Ungar
968c5a8282 Eager tree building for primaries 2019-09-13 17:22:50 -07:00
swift-ci
94d35be2ae Merge remote-tracking branch 'origin/master' into master-next 2019-09-10 09:29:47 -07:00