Commit Graph

542 Commits

Author SHA1 Message Date
Doug Gregor
2860557a77 [Name lookup] Use the declaration-based lookupQualified() where it’s easy.
Switch a number of callers of the Type-based lookupQualified() over to
the newer (and preferred) declaration-based lookupQualified(). These are
the easy ones; NFC.
2018-07-31 10:14:44 -07:00
swift-ci
6a3bded251 Merge remote-tracking branch 'origin/master' into master-next 2018-06-19 10:30:19 -07:00
Jordan Rose
e840330648 [Serialization] Handle llvm::Error in member deserialization recovery (#16957)
llvm::Expected/llvm::Error require that the error is not just checked
but explicitly handled. Since we're currently recovering as if nothing
happened, we need to use llvm::consumeError to throw the error info
away.

rdar://problem/40738521
2018-06-19 10:14:36 -07:00
swift-ci
2a0e83dc0d Merge remote-tracking branch 'origin/master' into master-next 2018-06-18 11:00:19 -07:00
Jordan Rose
e5cec5fdd9 Merge pull request #17186 from jrose-apple/bridge-over-troubled-imports
[Serialization] Always list the bridging header before any imports

rdar://problem/40471329
2018-06-18 10:42:09 -07:00
Bob Wilson
d933b5d60c Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 20:20:25 -07:00
Jordan Rose
570ed72ea5 Add assertions to prevent truncation when using llvm::endian::Writer (#17266)
Also, stop serializing a few constant values, saving a tiny bit of
space in swiftmodule files.
2018-06-15 19:26:35 -07:00
Jordan Rose
07b200130f [Serialization] Keep buffers alive if they may have diagnostics
This can only happen in one case today: a module imports a bridging
header, but the header on disk has disappeared, and now we need to
fall back to the (often inadequate) version that's stored inside the
swiftmodule file. Even if the module fails to load, the bridging
header has already been imported, and so anything else that happens
might still emit diagnostics and need that text to be alive, which
means we need to keep the buffer alive too.
2018-06-13 16:20:31 -07:00
swift-ci
dd7589a85c Merge remote-tracking branch 'origin/master' into master-next 2018-05-11 01:49:13 -07:00
Rintaro Ishizaki
6496175653 [Serialization] Omit local discrimiator from LocalDeclTableInfo
Local discriminators are emitted as a part of decl.
2018-05-11 15:37:40 +09:00
Rintaro Ishizaki
9fc09858ae [AST] Stop using side-table for local discriminators 2018-05-11 15:37:01 +09:00
swift-ci
289829000b Merge remote-tracking branch 'origin/master' into master-next 2018-05-04 13:09:41 -07:00
Jordan Rose
4714fcd50c Revert "Merge pull request #16211 from slavapestov/fix-inlinable-vs-autolinking"
This reverts commit bb16ee049d,
reversing changes made to a8d831f5f5.
It's not sufficient to solve the problem, and the choices were to do
something more complicated, or just take a simple brute force
approach. We're going with the latter.
2018-05-03 22:40:31 -06:00
swift-ci
7056b65bf5 Merge remote-tracking branch 'origin/master' into master-next 2018-05-02 15:09:04 -07:00
Jordan Rose
df2e63d07d Diagnose modules with circular dependencies (#16075)
This can't arise from a clean build, but it can happen if you have
products lingering in a search path and then either rebuild one of
the modules in the cycle, or change the search paths.

The way this is implemented is for each module to track whether its
imports have all been resolved. If, when loading a module, one of its
dependencies hasn't resolved all of its imports yet, then we know
there's a cycle.

This doesn't produce the best diagnostics, but it's hard to get into
this state in the first place, so that's probably okay.

https://bugs.swift.org/browse/SR-7483
2018-05-02 15:01:09 -07:00
swift-ci
9d46968584 Merge remote-tracking branch 'origin/master' into master-next 2018-05-01 20:48:51 -07:00
Slava Pestov
db440121b7 Serialization: Support '@_usableFromInline import'
Progress on <rdar://problem/39338239>; we still need to infer this
attribute though.
2018-05-01 17:56:15 -07:00
Slava Pestov
cfa0ab3dbe AST: Introduce ModuleDecl::ImportFilter::ForLinking
ModuleDecl::forAllVisibleModules() now has a includeLinkOnlyModules
parameter. This is intended to be used when computing the set of
libraries to autolink.
2018-05-01 17:53:51 -07:00
swift-ci
d3dacc306b Merge remote-tracking branch 'origin/master' into master-next 2018-04-30 20:49:19 -07:00
Doug Gregor
6bdd24d1ac Merge pull request #16268 from DougGregor/substitution-map-ast-adoption
[AST] Adopt SubstitutionMap as the storage mechanism for substitutions
2018-04-30 20:36:02 -07:00
Doug Gregor
ab56fa3e9c [Serialization] Support (de-)serialization of SubstitutionMaps.
Allow substitution maps to be serialized directly (via an ID), writing out
the replacement types and conformances as appropriate. This is a more
efficient form of serialization than the current SubstitutionList approach,
because it maintains uniqueness of substitution maps within a module file,
and is a step toward eliminating SubstitutionList entirely.
2018-04-30 16:21:58 -07:00
swift-ci
71a7529f6b Merge remote-tracking branch 'origin/master' into master-next 2018-04-27 05:28:59 -07:00
Slava Pestov
4d7950a9b2 Serialization: Remove obsolete 'HasUnderlyingModule' hack 2018-04-26 23:37:17 -07:00
Slava Pestov
8408f8221d Serialization: Replace ModuleDecl::ImportFilter math with explicit switch statements
This one is particularly obnoxious.
2018-04-26 23:37:17 -07:00
Adrian Prantl
8fc5c364fe typo 2018-02-28 14:32:33 -08:00
Adrian Prantl
0747d9a339 Force the DJB hash seed to 0 for compatibility with HashString.
The obsolete llvm::HashString() was equivalent to
llvm::djbHash(seed=0) and was removed from llvm. This patch replaces
all occurences of llvm::HashString() with llvm::djbHash(seed=0), no
functional change.

The default seed of llvm::djbHash() is supposed to yield a higher
quality result that using seed=0, but changing it looks like it
affects the ordering of SIL serialization.
2018-02-28 14:10:25 -08:00
Saleem Abdulrasool
a0c6a70c31 upstream-update: adjust for SVN r326091 2018-02-27 12:36:15 -08:00
Andrew Trick
66a579cc77 Add ModuleFile::isSIB
We can't make the same assumptions about .sib files.

Ideally, we should serialize the module's stage and set WasDeserializedCanonical
based on that state. However, we probably still want the IsSIB flag for
assertions.
2018-02-09 09:55:47 -08:00
Doug Gregor
8c05278ef3 [Clang importer] Lazily load all named members with a matching base name.
When loading the named members for a given name, we want to load all
of the members with that base name... not only the ones that match the
full name, because the lookup table is indexed by base name and
filtering too early drops candidates.

Fixes rdar://problem/36085994.
2017-12-15 23:54:36 -08:00
Graydon Hoare
9d7b26fd40 [NamedLazyMemberLoading] Return empty vector rather than None on no-match. 2017-12-01 16:52:25 -08:00
Graydon Hoare
758a016024 [NamedLazyMemberLoading] Add "loading members" pretty stack trace when deserializing. 2017-12-01 16:52:24 -08:00
Arnold Schwaighofer
eba12a7c3e Revert "Finish and default-enable named lazy member loading" 2017-12-01 07:25:54 -08:00
Graydon Hoare
d3bcdfd8e6 [NamedLazyMemberLoading] Return empty vector rather than None on no-match. 2017-11-30 22:19:37 -08:00
Graydon Hoare
cafb596170 [NamedLazyMemberLoading] Add "loading members" pretty stack trace when deserializing. 2017-11-30 22:01:05 -08:00
Graydon Hoare
412bf0bff1 [NamedLazyMemberLoading] Eat errors properly with llvm::consumeError. 2017-11-30 22:01:05 -08:00
Doug Gregor
b1aa23a222 [Serialization] Allow clients to deserialize all generic signatures.
As a debugging aid, allow clients to deserialize all generic signatures
in a given module file.
2017-11-07 15:17:20 -08:00
Doug Gregor
82e1c98e46 [Serialize] Serialize uniqued generic signatures.
Rather than inlining generic signatures in a half dozen places throughout
the serialization format, serialize (uniqued) generic signatures with their
own GenericSignatureID. Update various layouts (generic function types,
SIL function types, generic environments, extension cross-references) to
use GenericSignatureID.

Shaves ~187k off the size of Swift.swiftmodule.
2017-11-07 13:36:22 -08:00
Graydon Hoare
ed0b43cbce [NamedLazyMemberLoading] Move SerialID to IDC, get extensions working. 2017-11-01 17:35:46 -07:00
Graydon Hoare
7163ebc357 [NamedLazyMemberLoading] Stop scanning DECL_MEMBER_TABLES_BLOCK_ID for abbrevs at first record. 2017-11-01 17:35:46 -07:00
Graydon Hoare
da32bb03ee [NamedLazyMemberLoading] Scan abbrevs out of DECL_MEMBER_TABLES_BLOCK_ID. 2017-11-01 17:35:46 -07:00
Graydon Hoare
f034114f58 [NamedLazyMemberLoading] Implement ModuleFile::loadNamedMembers using tables. 2017-11-01 17:35:46 -07:00
Graydon Hoare
5eca5f5161 [NamedLazyMemberLoading] Write serialized decl member tables. 2017-11-01 17:35:46 -07:00
Graydon Hoare
c78e04cd4f [NamedLazyMemberLoading] Add initial bits of serialized Decl member tables. 2017-11-01 17:35:46 -07:00
Graydon Hoare
7ba241dada [NamedLazyMemberLoading] Rename CLASS_MEMBERS{,_FOR_DYNAMIC_LOOKUP} for clarity 2017-11-01 17:34:56 -07:00
Doug Gregor
fc20debc36 Jump through hoops to avoid adding a new Serialization -> clang::Module dependency. 2017-09-15 14:42:36 -07:00
Doug Gregor
27c8c4a8a1 [Serialization] Rewrite cross-references to private frameworks.
When serializing cross-references to a (private) module that is
re-exported through another (public) module, record the
cross-reference as if the entity were found in named public module.

Finishes rdar://problem/34438586.
2017-09-14 15:09:18 -07:00
Jordan Rose
1c651973c3 Excise "Accessibility" from the compiler (2/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the 'Accessibility' enum to be named 'AccessLevel'.
2017-08-28 11:34:44 -07:00
Jordan Rose
5f30eac288 Excise "Accessibility" from the compiler (1/3)
"Accessibility" has a different meaning for app developers, so we've
already deliberately excised it from our diagnostics in favor of terms
like "access control" and "access level". Do the same in the compiler
now that we aren't constantly pulling things into the release branch.

This commit changes the names of methods, fields, a few local
variables, and even a swift-ide-test flag. The full list is below.

accessibilityForDiagnostics -> accessLevelForDiagnostics
checkAccessibility -> checkAccess
checkGenericParamAccessibility -> checkGenericParamAccess
checkTypeAccessibility -> checkTypeAccess
checkWitnessAccessibility -> checkWitnessAccessibility
computeAccessibility -> computeAccessLevel
computeDefaultAccessibility -> computeDefaultAccessLevel
fixItAccessibility -> fixItAccess
getAccessibilityString -> getAccessLevelString
getAccessibilityStrictly -> getAccessLevelStrictly
getAccessibilityUID -> getAccessLevelUID
getActualAccessibility -> getActualAccessLevel
getDefaultAccessibility -> getDefaultAccessLevel
getMaxAccessibility -> getMaxAccessLevel
getOverridableAccessibility -> getOverridableAccessLevel
getRawStableAccessibility -> getRawStableAccessLevel
getSetterAccessibility -> getSetterFormalAccess
hasAccessibility -> hasAccess
hasDefaultAccessibility -> hasDefaultAccessLevel
inferAccessibility -> inferAccessLevel
inferDefaultAccessibility -> inferDefaultAccessLevel
inferSetterAccessibility -> inferSetterAccessLevel
overwriteAccessibility -> overwriteAccess
overwriteSetterAccessibility -> overwriteSetterAccess
printAccessibility -> printAccess
requiredAccessibilityForDiagnostics -> requiredAccessForDiagnostics
resolveAccessibility -> resolveAccessControl
setAccessibility -> setAccess
setSetterAccessibility -> setSetterAccess
setDefaultAndMaxAccessibility -> setDefaultAndMaxAccess
validateAccessibility -> validateAccessControl

Accessibility -> AccessLevel
AccessibilityFilter -> AccessFilter
IgnoreAccessibility -> IgnoreAccessControl
NL_IgnoreAccessibility -> NL_IgnoreAccessControl
PrintAccessibility -> PrintAccess
PrintInternalAccessibilityKeyword -> PrintInternalAccessKeyword
SetterAccessibility -> SetterAccessLevel

setterAccessibility -> setterAccess
storedPropertyAccessibility -> storedPropertyAccess

-print-accessibility -> -print-access
2017-08-28 11:11:57 -07:00
Jordan Rose
35f8e17e88 [Serialization] Drop extensions whose base type can't be deserialized. (#11323)
This shows up with swift_wrapper typedefs, which get imported into
Swift as structs. If someone makes an extension of a swift_wrapper
type, but the swift_wrapper is only applied in Swift 4 mode, that
extension will break any Swift 3 clients. Recover by just dropping
the extension entirely.

There's still more complexity around extensions---what if a
requirement can't be deserialized? what if something's depending on
the protocol conformance provided by the extension?---but the missing
base type case should be pretty safe. If you can't see the type at
all, things that depend on its conformances are already in trouble.

rdar://problem/33636733
2017-08-03 16:02:16 -07:00
Alex Hoppen
2eb36e41f5 Introduce special name for destructors
This name is not used yet
2017-07-28 10:46:50 +02:00