Commit Graph

848 Commits

Author SHA1 Message Date
Harlan Haskins
b904133c42 [Modules] Add flag to skip non-inlinable function bodies
This flag, currently staged in as `-experimental-skip-non-inlinable-function-bodies`, will cause the typechecker to skip typechecking bodies of functions that will not be serialized in the resulting `.swiftmodule`. This patch also includes a SIL verifier that ensures that we don’t accidentally include a body that we should have skipped.

There is still some work left to make sure the emitted .swiftmodule is exactly the same as what’s emitted without the flag, which is what’s causing the benchmark noise above. I’ll be committing follow-up patches to address those, but for now I’m going to land the implementation behind a flag.
2019-09-26 10:40:11 -07:00
Harlan Haskins
29bc645104 [TBDGen] Set installapi flag only when building in installapi (#27315)
Previously, we would unconditionally set the `installapi` flag, which
hard errors when trying to merge with a TAPI-generated TBD file that
was generated during the install phase.

Fixes rdar://42406088
2019-09-24 09:52:12 -07:00
David Ungar
a9a9069591 change compare-to-astScope-lookup to crosscheck-unqualified-lookup 2019-09-22 17:59:39 -07:00
David Ungar
c7be2def90 Merge pull request #27143 from davidungar/A-9-12-eager-off
[NFC NameLookup ASTScope] Fixes for large app, eager primary tree creation, memberCount fix.
2019-09-14 18:46:17 -07:00
David Ungar
3afd6a7146 add flag to stress scope creation 2019-09-13 22:30:49 -07:00
Harlan Haskins
c82c9b8210 [ModuleInterfaces] Remove references to 'parseable' interfaces everywhere
Now that we've settled on Module Interface as the name, let's remove the
vestiges of "Parseable Interfaces"
2019-09-13 14:55:48 -07:00
David Ungar
1415f2f7f9 LazyASTScopes only matters when ASTScopes are enabled 2019-08-28 11:31:17 -07:00
David Ungar
7992e1c6c4 Lots of cleanups, renamings, etc. 2019-08-26 16:55:18 -07:00
Doug Gregor
b4e80cfd90 [Constraint graph] Enable one-way constraints in function builders.
Enable one-way constraints by default for function builders, finishing
rdar://problem/50150793.
2019-08-19 22:49:15 -07:00
Doug Gregor
7697611c15 Merge pull request #25983 from DougGregor/one-way-constraints
[Constraint solver] Introduce one-way binding constraints.
2019-08-14 09:19:11 -07:00
David Ungar
b02b4b00ef Cleanup and fixes, also 1st cut at lazy. 2019-08-13 17:48:06 -07:00
Doug Gregor
be73a9d641 [Function builders] Add one-way constraints when applying function builders
When we transform each expression or statement in a function builder,
introduce a one-way constraint so that type information does not flow
backwards from the context into that statement or expression. This
more closely mimics the behavior of normal code, where type inference
is per-statement, flowing from top to bottom.

This also allows us to isolate different expressions and statements
within a closure that's passed into a function builder parameter,
reducing the search space and (hopefully) improving compile times for
large function builder closures.

For now, put this functionality behind the compiler flag
`-enable-function-builder-one-way-constraints` for testing purposes;
we still have both optimization and correctness work to do to turn
this on by default.
2019-08-13 12:38:46 -07:00
Harlan Haskins
7f07db5466 Merge pull request #26481 from owenv/print_diag_names
Add -debug-diagnostic-names frontend flag
2019-08-09 15:44:26 -07:00
David Ungar
09342dfa47 Add frontend flag -warn-if-astscope-lookup w/ test 2019-08-06 23:17:49 -07:00
Owen Voorhees
e7a1a1cc3d Add -debug-diagnostic-names frontend flag
This flag adds diagnostic names to the end of their messages, e.g. 'error: cannot convert value of type '[Any]' to specified type '[Int]' [cannot_convert_initializer_value]'. It's intended to be used for debugging purposes when working on the compiler.
2019-08-05 18:54:21 -07:00
Jordan Rose
88405bc2f3 [ModuleInterface] Honor -disable-modules-validate-system-headers
The point of this flag is to avoid re-checking the whole SDK on every
build, since under many circumstances you can assume it hasn't
changed. That worked for Clang modules, but Swift cached modules also
end up with dependencies that shouldn't be updated.

rdar://problem/53279521
2019-07-18 18:38:31 -07:00
pschuh
c54b30ab71 Update coverage options for fuzzing to match clang (#26156) 2019-07-17 12:25:39 -07:00
pschuh
4fd0671e54 Merge pull request #25870 from pschuh/cpp-1
Add -enable-cxx-interop flag and support for extern "C" {}
2019-07-09 11:37:31 -07:00
Sergej Jaskiewicz
0ac6f3a3ad [Driver] Automatic -color-diagnostics flag is added *before* -Xfrontend 2019-07-09 15:53:35 +03:00
Parker Schuh
fa69a73ee4 Add -enable-cxx-interop flag and support for extern "C" {} 2019-07-08 11:43:35 -07:00
Sergej Jaskiewicz
0ed3bb1e17 [Driver] Implement -no-color-diagnostics flag 2019-07-08 04:22:06 +03:00
Doug Gregor
d0c5b6a4e1 Drop the unused -enable-opaque-result-types command-line option 2019-07-05 11:34:10 -07:00
Saleem Abdulrasool
f3655ed5b4 Frontend: correct -sdk search paths for !Darwin
This adjusts the runtime library import paths to add the OS/architecture
subdirectory to the path.  This allows the use of `-sdk` with the
compiler to target Android and Windows as well (and Linux).  The SDK
image is identical to that generated by the current CMake setup without
the host tools.  Ideally, we would change the layout for the modules on
other targets to be identical to the Darwin layout which converts to
OS/<module>/architecture.<extension> rather than
OS/architecture/<module>.<extension>.
2019-07-03 08:39:16 -07:00
Mike Ash
9df513ae7c [Interpreter] Clean up the /usr/lib/swift fallback code.
- Check the target triple at runtime to decide whether to use the fallback.
- Change isInResourceDir to actually check the resource dir.
- Use ArrayRef<std::string> instead of std::vector<std::string>.
2019-07-01 13:08:04 -04:00
Mike Ash
3f774094b7 [Interpreter] Fall back to loading Swift dylibs from /usr/lib/swift on Apple platforms.
Continue to load the dylibs next to the compiler if they exist. If they don't, then use the OS's dylibs.

rdar://problem/47528005
2019-07-01 13:08:04 -04:00
David Ungar
33204e1519 Fixes 2019-06-27 16:17:13 -07:00
David Ungar
599c51fe92 Fix default 2019-06-27 15:37:31 -07:00
David Ungar
c3c1f3ecce Default to disabling ASTScopeLookup 2019-06-23 12:48:41 -07:00
David Ungar
3a3145c0f4 Alternate SelfDC computation, fixes, and cleanups.
ASTScopeLookup by default
Create empty fn bodies for IDE tests.
Include initializer source range for property wrappers.
Add -disable-astscope-lookup
2019-06-23 09:17:09 -07:00
Arnold Schwaighofer
85bfbe2dd3 Merge pull request #25473 from aschwaighofer/back_deploy_dynamic_replacement
stdlib: Add backward deployment versions for the dynamic-replacement runtime functions
2019-06-18 09:02:22 -07:00
Arnold Schwaighofer
5d329464d6 Use thread private key to avoid weak linkage
We use one bit of the third reserved swift private tls key.

Also move the functionality into a separate static archive that is
always linked dependent on deployment target.
2019-06-17 15:03:45 -07:00
Alexis Laferrière
36e5b5ae78 Merge pull request #25152 from xymus/explicit-intro-version
Add CLI option to warn when a public decl has no introduction version
2019-06-17 15:01:41 -07:00
Alexis Laferrière
c44cff7c97 Add a CLI option to warn when a public decl has no availability
Add the command line option -require-explicit-availability to detect public
or `@usableFromInline` declarations and warn if they don't declare
an introduction OS version. This option should catch forgotten `@available`
attributes in frameworks where all services are expected to be introduced
by an OS version.

The option -require-explicit-availability-target "macOS 10.14, iOS 12.0"
can be specified for the compiler to suggest fix-its with the missing
attributes `@available(macOS 10.14, iOS 12.0, *)`.

rdar://51001662
2019-06-17 10:32:58 -07:00
Harlan Haskins
047749a745 Merge pull request #25419 from harlanhaskins/property-reprs
[ModuleInterface] Qualify all types in module interfaces
2019-06-14 14:23:08 -07:00
David Ungar
06527db4ab Merge pull request #24594 from davidungar/A5-7-ASTOOScope-rebased
[NameLookup] ASTOOScope ontology
2019-06-14 08:03:09 -07:00
Harlan Haskins
57f517317d Rename flag to ‘module-interface-preserve-types-as-written’ 2019-06-13 11:26:54 -07:00
Harlan Haskins
889e43076f [ModuleInterface] Allow falling back to prefer TypeReprs
There are still cases (a module with a type that's the same name as the
module) where we cannot fully qualify all types. In those cases, allow
them to remain unqualified with a flag, `-Xfrontend
-preserve-types-as-written-in-module-interface`.
2019-06-13 11:26:54 -07:00
David Ungar
6cfcabd8e5 add -disable-parser-lookup 2019-06-11 09:08:10 -07:00
Mishal Shah
c2848e793f Merge pull request #25236 from apple/update-master-xcode-11-beta1
Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs
2019-06-06 11:22:40 -07:00
mishal_shah
1e38fc3030 Update master to build with Xcode 11 beta, macOS 10.15, iOS 13, tvOS 13, and watchOS 6 SDKs 2019-06-03 22:50:02 -07:00
Joe Groff
4ed8de10f9 Revert "Revert "Use autolinking to pull in compatibility libraries."" 2019-06-03 20:10:51 -07:00
Joe Groff
a7cc3a38cc Revert "Use autolinking to pull in compatibility libraries." 2019-06-03 14:18:39 -07:00
Raj Barik
d40207743c Merge pull request #25038 from atrick/fix-specializer-leak
Fix ExistentialSpecializer to correctly cleanup storage.
2019-06-03 09:31:47 -07:00
Joe Groff
dffd1b27a1 Use autolinking to pull in compatibility libraries.
Many build systems that support Swift don't use swiftc to drive the linker. To make things
easier for these build systems, also use autolinking to pull in the needed compatibility
libraries. This is less ideal than letting the driver add it at link time, since individual
compile jobs don't know whether they're building an executable or not. Introduce a
`-disable-autolink-runtime-compatibility` flag, which build systems that do drive the linker
with swiftc can pass to avoid autolinking.

rdar://problem/50057445
2019-05-31 13:11:14 -07:00
Arnold Schwaighofer
7e646847c7 SILGen: Add an option to disable the previous implementation inside of dynamic replacement thunks
@_dynamicReplacement(for: selfRec(x: acc:))
  func selfRec_r(x: Int, acc: Int) -> Int {
    if x <= 0 {
      return acc
    }
    // Normally, this will call selfRec(x: acc:)'s implementation.
    // With the option, this will call to selfRec_r(x: acc:).
    return selfRec(x: x - 1, acc: acc + 1)
  }

rdar://51229650
2019-05-29 11:31:27 -07:00
David Ungar
663760e3b7 ASTOOScope ontology 2019-05-28 10:48:22 -07:00
Andrew Trick
2ce1473b74 [NFC] Remove remnants of the old -sil-existential-specializer option.
This option no longer works but was still in the option file and help
message.

Add a temporary pass-specific option instead for debugging until this
pass has been sufficiently tested yet.
2019-05-23 17:20:34 -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
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