Commit Graph

678 Commits

Author SHA1 Message Date
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
Jordan Rose
d4ac04d25e Move access-path filtering into ModuleNameLookup (out of lookupValue) (#27097)
Removes duplicated logic from the implementations of
FileUnit::lookupValue, and simplifies the interface to
ModuleDecl::lookupValue, where everyone was passing an empty
(non-filtering) access path anyway /except/ during actual lookup from
source code. No functionality change.
2019-09-10 09:13:20 -07:00
swift-ci
af96552a20 Merge remote-tracking branch 'origin/master' into master-next 2019-08-29 16:50:55 -07:00
Slava Pestov
3956fc0653 AST: Fold forAllImportedModules() into collectLinkLibraries() 2019-08-29 15:57:38 -04:00
Slava Pestov
2256b1fcc2 AST: Introduce namelookup::getAllImports() to replace forAllVisibleModules() 2019-08-29 15:57:38 -04:00
swift-ci
895176fab0 Merge remote-tracking branch 'origin/master' into master-next 2019-08-28 18:09:45 -07:00
Slava Pestov
3819f341bd AST: Use ImportCache to simplify SourceFile::isImportedImplementationOnly() 2019-08-28 16:29:49 -04:00
Slava Pestov
acf5371dfc AST: Introduce a new ImportCache singleton 2019-08-28 16:29:49 -04:00
Arnold Schwaighofer
20efacf2d6 Merge remote-tracking branch 'upstream/master' into master-next 2019-08-26 13:30:41 -07:00
Jordan Rose
c50113185f Merge pull request #26816 from jrose-apple/cant-stand-the-rain
Fix a pair of leaks related to FileUnit destructors not being run
2019-08-26 11:06:54 -07:00
Arnold Schwaighofer
2b41f8d8d5 Merge remote-tracking branch 'origin/master' into master-next 2019-08-26 08:57:42 -07:00
Slava Pestov
b5b3718b0d AST: Some const goodness for ModuleDecl 2019-08-23 23:35:25 -04:00
Jordan Rose
5c785d42b3 Enforce that FileUnit + LoadedFile have trivial destructors
We already do this for other ASTContext-allocated types (see
Decl.cpp). This will prevent the sort of mistakes in the previous two
commits.

Note that if any particular subclass of FileUnit wants to have its
destructor run, it can opt into that manually using
ASTContext::addDestructorCleanup. SourceFile and BuiltinUnit both do
this. But we generally don't /want/ to do this if we can avoid it
because it adds to compiler teardown time.
2019-08-23 17:40:46 -07:00
Jordan Rose
e479e1398d [Serialization] Use the module interface as the name of the file
...rather than the buffer, for a compiled module that came from a
module interface.

This was already happening at a higher level
(ModuleDecl::getModuleFilename) so pushing it down to the low-level
ModuleFile::getModuleFilename doesn't really change things much. The
important fix that goes with this is that SerializedASTFile no longer
leaks this name by storing it outside of ModuleFile.

https://bugs.swift.org/browse/SR-11365
2019-08-23 17:40:45 -07:00
swift-ci
c4a70d09b7 Merge remote-tracking branch 'origin/master' into master-next 2019-08-20 16:30:12 -07:00
Jordan Rose
c4ee7ecdc3 Merge pull request #26735 from jrose-apple/heart-healthy
[Serialization] Remove several unnecessary bits of helper logic
2019-08-20 16:20:35 -07:00
swift-ci
c97950d7da Merge remote-tracking branch 'origin/master' into master-next 2019-08-19 21:30:00 -07:00
Slava Pestov
ea5cdd06a3 AST: Remove a couple of expensive FrontendStatsTracers 2019-08-19 23:00:57 -04:00
Slava Pestov
94c5a35bf2 AST: Add some counters related to name lookup 2019-08-19 23:00:57 -04:00
Jordan Rose
c6f033d400 [Serialization] Use existing logic to print a hierarchical module name
No intended functionality change.
2019-08-19 18:27:52 -07:00
Jonas Devlieghere
54dc4a6bab Update make_unique call after the utility got removed upstream.
This probably got auto-merged from master.
2019-08-18 12:53:32 -07:00