Commit Graph

1508 Commits

Author SHA1 Message Date
David Ungar
663760e3b7 ASTOOScope ontology 2019-05-28 10:48:22 -07:00
Jordan Rose
9647483aee Warn when using '@_implementationOnly' inconsistently in a module (#24800)
I thought it would be useful to allow some uses of a module to be
'@_implementationOnly' and others to not be in case someone wanted to
change from one to the other gradually, but it turns out that if
you're trying to /make/ an import implementation-only, you want to
know everywhere you used it.

rdar://problem/50748157
2019-05-16 09:13:34 -07:00
Jordan Rose
def1ccac66 Don't print extensions to conform to protocols that aren't printed
Try a little harder to avoid printing empty extensions by seeing if
any of the inherited protocols are actually going to be printed.
Previously this just made things a little prettier, but with
implementation-only imports it's a correctness issue, since there may
be extensions of implementation-only types that do in fact conform to
non-public protocols.

rdar://problem/50748072
2019-05-14 16:16:28 -07:00
Jordan Rose
e43a9f5475 [ModuleInterface] Propagate availability for synthesized extensions (#24753)
Otherwise, we can synthesize an extension that's extending a type
that's unavailable on a particular platform, or that conforms to a
protocol that hasn't been introduced on the minimum deployment target.
2019-05-13 19:55:00 -07:00
Harlan Haskins
5cb98bfe80 [ModuleInterface] Pass -Rmodule-interface-rebuild to sub-invocation (#24737)
Previously, we wouldn't pass this flag to sub-invocations, which means
that if we had to fall back and recompile a transitive import, we
wouldn't get a remark.

rdar://50729662
2019-05-13 12:56:18 -07:00
Rintaro Ishizaki
6956089b0b [CodeCompletion] Complete Swift only module name after 'import'
rdar://problem/39392446
2019-05-08 10:11:52 -07:00
Jordan Rose
517f5d6b6a [ClangImporter] Retire the term "adapter" in favor of "overlay" (#24427)
Way back in Swift 1 I was trying to draw a distinction between
"overlays", separate libraries that added Swift content to an existing
Objective-C framework, and "the Swift part of a mixed-source
framework", even though they're implemented in almost exactly the same
way. "Adapter module" was the term that covered both of those. In
practice, however, no one knew what "adapter" meant. Bring an end to
this confusion by just using "overlay" within the compiler even for
the mixed-source framework case.

No intended functionality change.
2019-05-03 11:11:58 -07:00
Harlan Haskins
f978cb0ba3 Merge pull request #24424 from harlanhaskins/an-absolutely-remarkable-thing
[ModuleInterface] Emit remarks when rebuilding from an interface
2019-05-02 22:45:15 -07:00
Harlan Haskins
dfe4491702 [ModuleInterface] Emit remarks when rebuilding from an interface
Keep track of information that led the module interface loader to reject loading a compiled module, if it needed to fall back to compiling an interface.

rdar://47792754
2019-05-02 17:46:34 -07:00
Harlan Haskins
6f0d1378d3 [Frontend] Add -Rmodule-interface-rebuild
Passing this will turn on remarks if the module loader needed to fall back and compile a module from an interface.
2019-05-02 10:39:16 -07:00
Harlan Haskins
42e1c2f07a [test] Add expected-remark to DiagnosticVerifier 2019-05-01 18:22:43 -07:00
Jordan Rose
3d16557c7f [ModuleInterface] Look for a prebuilt module by full target name (#24402)
Although the default cache location separates by platform, a
/combined/ cache is still an interesting idea, and in that case we
need to use the full platform names.
2019-05-01 13:48:32 -07:00
Harlan Haskins
81a68f28ef [Frontend] Default the prebuilt cache to <resourcedir>/<platform>/prebuilt-modules (#24295)
By default, prebuilt modules will live in
<resource-dir>/<platform>/prebuilt-modules, so make this explicit if it wasn't
passed in explicitly.
2019-04-26 13:52:41 -07:00
Slava Pestov
3f5a06bc3e AST: Always diagnose request evaluator cycles 2019-04-22 22:22:23 -04:00
Brent Royal-Gordon
814d50c7e6 Merge pull request #24163 from brentdax/line-line-line-line
Add -debug-constraints-on-line flag
2019-04-22 16:54:00 -07:00
Brent Royal-Gordon
3dca63efea Remove early returns in ParseLangArgs
Several places in language option parsing return early after diagnosing an error when they could instead continue parsing and discover addtional errors to diagnose. Change these to set an error flag instead.

OPT_package_description_version still has an early return on the theory that, if you’re using a too-old compiler to parse a Package.swift file, you’re probably confused about the Swift compiler version you’re using and further errors may be for arguments that would be accepted by a newer compiler.
2019-04-22 14:00:47 -07:00
Brent Royal-Gordon
79cee8daad Add -debug-constraints-on-line flag 2019-04-22 13:59:50 -07:00
adrian-prantl
ecebf70745 Merge pull request #24173 from adrian-prantl/memorybufferloader
Factor out the pre-registered MemoryBuffer functionality
2019-04-22 11:32:06 -07:00
Adrian Prantl
b244b0928e Factor out the pre-registered MemoryBuffer functionality
form SerializedModuleLoader into its own ModuleLoader class. (NFC-ish)

This gives better control over the order in which the various module
load mechanisms are applied.
2019-04-22 09:17:08 -07:00
adrian-prantl
f75dea49df Merge pull request #23910 from adrian-prantl/49751363
Record parseable interface imports in the debug info.
2019-04-19 14:23:57 -07:00
Harlan Haskins
24c35f3ff1 [ModuleInterface] Error for out-of-date modules in the resource-dir (#24139)
If we're loading a .swiftmodule from the resource dir adjacent to the compiler,
defer to the serialized loader instead of falling back. This is mainly to
support development of Swift, where one might change the module format version
but forget to recompile the standard library. If that happens, don't fall back
and silently recompile the standard library -- instead, error like we used to.

rdar://49926152
2019-04-19 10:36:37 -07:00
Joe Groff
5e1497967a Parse opaque types. 2019-04-17 14:43:32 -07:00
swift-ci
4dc763aa4b Merge pull request #23964 from atrick/fix-prespecialize 2019-04-16 16:57:57 -07:00
Michael Gottesman
83bce036bb [sil] Fix thinko in a frontend option. 2019-04-14 01:58:19 -07:00
Michael Gottesman
6319820b73 Merge pull request #24021 from gottesmm/pr-b7b7d99bb250853de9886919f2a787ef5990b6b2
[ownership] Add a frontend option to strip ownership after serializat…
2019-04-14 01:04:58 -07:00
Michael Gottesman
1defc94966 [ownership] Add a frontend option to strip ownership after serialization.
I am going to use this to ensure some end-to-end tests that do not inline from
the stdlib will work after flipping the switch and stripping ownership after
serialization.
2019-04-13 20:53:42 -07:00
eeckstein
395750fbaa Merge pull request #23999 from eeckstein/fix-gsil
DebugInfo: fix debugging on SIL level
2019-04-13 18:48:49 -07:00
Harlan Haskins
fec837a00d [ParseableInterfaces] Improvements to forwarding module dependencies (#23968)
- Fix a typo in the debug output for finding a prebuilt module
- Don't add the prebuilt module path to the dependency tracker
- Ensure we're registering the _forwarding module_'s dependencies in
cached modules, not the prebuilt module's dependencies.
- Check for the existence of a prebuilt module before doing the
is-up-to-date check (which will have failed anyway if it didn't exist).
- Test that forwarding module dependency collection works

rdar://48659199
2019-04-13 00:11:22 -07:00
Harlan Haskins
3586952071 Merge pull request #23969 from harlanhaskins/thats-imparseable
[ModuleInterfaces] Rename 'parseable interfaces' to 'module interfaces'
2019-04-12 18:37:04 -07:00
Erik Eckstein
b8c226cb08 DebugInfo: fix debugging on SIL level
The fix is to set the DebugCompilationDir when -gsil is used.
Otherwise no debug info is generated if the source file name does not contain a path.

rdar://problem/49796695
2019-04-12 16:12:17 -07:00
Jordan Rose
f6c7973911 Teach -verify-apply-fixes to handle overlapping fix-its (#23970)
...by coalescing duplicates and dropping conflicts. Both cases can
happen with "expected-error 2 {{...}}": we might get multiple fix-its
providing the same new message, or one message might have diverged
into two, giving us incompatible changes.
2019-04-12 13:19:54 -07:00
Harlan Haskins
ea7e7e918f [ModuleInterface] Remove 'parseable interface' from diagnostics
Part of rdar://49359734
2019-04-11 18:05:09 -07:00
Harlan Haskins
e5456984f7 [ModuleInterfaces] Remove 'parseable' from command-line flags
Leave the old flag in as an alias to the new flag, for transition
purposes. Also go ahead and remove the long-deprecated and unused
`emit-interface-path`.

Part of rdar://49359734
2019-04-11 18:05:09 -07:00
Adrian Prantl
8d03cb7a61 Record parseable interface imports in the debug info.
When a Swift module built with debug info imports a library without
debug info from a textual interface, the textual interface is
necessary to reconstruct types defined in the library's interface.  By
recording the Swift interface files in DWARF dsymutil can collect them
and LLDB can find them.

rdar://problem/49751363
2019-04-11 14:50:07 -07:00
Andrew Trick
b17ccdee06 OnoneSupport library: only check ABI when building an object.
Don't check for all ABI symbols when building the OnoneSupport
.swiftmodule. Whether we serialize all symbols is irrelevant. They
only need to be in the dylib for ABI purposes.
2019-04-11 12:14:35 -07:00
Harlan Haskins
0999bfed74 Revert "Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules""
This re-disables explicit optimization of cached modules.

rdar://46358840
2019-04-10 15:30:27 -07:00
Harlan Haskins
7969705230 Merge pull request #23857 from harlanhaskins/shock-and-awe
[ParseableInterfaces] Short-circuit module loading in the PIML
2019-04-08 14:21:11 -07:00
Michael Gottesman
91dbbc3088 Merge pull request #23204 from compnerd/silence-in-the-library
Remove custom handling in add_swift_host_library
2019-04-08 10:49:42 -07:00
Harlan Haskins
149367e5d5 [ParseableInterfaces] Short-circuit module loading
Previously, the ParseableInterfaceModuleLoader relied on the assumption
that, if it returned `errc::not_supported`, it would fall through the
search paths and then move on to the SerializedModuleLoader. This did
not anticipate the possibility of a valid .swiftinterface coming later
in the search paths, which can cause issues for the standard library
which is in the resource-dir and should always be loaded from there.

Instead, make the module loading explicitly short-circuit when seeing
`errc::not_supported`, and document it.

Also add some more logging throughout `discoverLoadableModule` so we can
more easily catch issues like this in the future.

Fixes rdar://49479386
2019-04-08 10:07:11 -07:00
swift-ci
6dacc8b3fb Merge pull request #23831 from nathawes/parseable-interface-fix-windows-paths 2019-04-07 15:43:42 -07:00
Nathan Hawes
02e422e5fe [ParseableInterface] Normalize paths before comparison when serializing dependencies
Dependencies in the SDK have their paths serialized relative to it to allow the
produced swift module to stay valid when the SDK moves. In the windows build
mixed slashes were coming through in these paths and breaking the check for
whether a dependency was in the SDK or not.

This patch ensures both paths are using native path separators prior to the
comparison to hopefuly fix the Windows build.
2019-04-07 11:39:02 -07:00
David Ungar
cf5d81c889 Merge pull request #23735 from davidungar/tracking-primary
[Batch mode] Cope with bugs that cause error  suppression.
2019-04-05 17:45:20 -07:00
Rintaro Ishizaki
4ab983bc2e Revert "[ParseableInterfaces] Stop explicitly optimizing cached modules" 2019-04-04 16:43:48 -07:00
swift-ci
8fc305c03e Merge pull request #23779 from adrian-prantl/48827784 2019-04-04 11:09:11 -07:00
Harlan Haskins
406c005333 [ParseableInterfaces] Stop explicitly optimizing cached modules
Previously, we always optimized cached modules. Now, use the flag we're
already preserving to optimize them.

Fixes rdar://46358840
2019-04-03 16:24:47 -07:00
Adrian Prantl
4a23512068 Add an option to disable DWARF skeleton CU breadcrumbs for Clang
module imports. This is useful when building redistributable static
archives, since any pointers into the CLang module cache won't be
portable.

When using this option the Clang type fallback path in LLDB will be
less useful since DWARF type information from those modules will not
be available unless another object file compiled without the option
imported the same modules.

rdar://problem/48827784
2019-04-03 15:45:11 -07:00
David Ungar
44daa88ebd Format 2019-04-03 12:53:31 -07:00
David Ungar
9cc3a4a9d8 Rename defaultDiagnosticLoc to bufferIndirectlyCausingDiagnostic. 2019-04-03 12:52:49 -07:00
Nathan Hawes
7144dab15a [ParseableInterface] Don't report out-of-date dependencies to the parent dependency tracker
We previously added dependencies to the tracker inline while validating a cached
module's dependencies were up to date. If one of its dependencies ended up being
out of date though, we shouldn't have added the previous dependencies, as that
means the dependency list itself was also out of date.

This patch changes the behavior to only add the module's dependencies once we've
verified they're all up to date.
2019-04-03 06:35:11 -07:00
Nathan Hawes
58d622d796 [ParseableInterface] Don't serialize resource directory deps and stop adding cached modules to the dependency tracker
This patch modifies ParseableInterfaceBuilder::CollectDepsForSerialization to
avoid serializing dependencies from the runtime resource path into the
swiftmodules generated from .swiftinterface files. This means the module cache
should now be relocatable across machines.

It also modifies ParseableInterfaceModuleLoader to never add any dependencies
from the module cache and prebuilt cache to the dependency tracker (in addition
to the existing behaviour of not serializing them in the generated
swiftmodules). As a result, CollectDepsForSerialization no longer checks if the
dependencies it is given come from the cache as they are provided by the
dependency tracker. It now asserts that's the case instead.
2019-04-03 06:35:11 -07:00