Commit Graph

716 Commits

Author SHA1 Message Date
swift-ci
cd7ed018bf Merge remote-tracking branch 'origin/main' into rebranch 2021-09-02 11:56:28 -07:00
Varun Gandhi
4a16261c4d [Driver] Update OS versions for rpath checks.
Make sure that we add the appropriate rpaths so that the appropriate
_Concurrency back-deployment library can be picked up.

We don't need to update the Swift driver since it uses the C++ driver
as the source of truth to determine if the relevant rpath should be
added or not.
2021-09-01 15:37:24 -07:00
swift-ci
86f6f2e622 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-22 14:34:00 -07:00
Xi Ge
1a660c08ca Frontend: teach -compile-module-from-interface action to emit ABI descriptor as byproduct
We have implemented a libSwiftDriver-based tool to generate prebuilt module cache for
entire SDKs. Anchored on the same infrastructure, we could also generate ABI baselines
for entire SDKs.
2021-08-20 15:47:10 -07:00
swift-ci
44195c4ce3 Merge remote-tracking branch 'origin/main' into rebranch 2021-08-13 22:13:27 -07:00
Alexis Laferrière
577886408b [Frontend] Emit incr compilation info from emit-module jobs
Enable emitting the module-level incremental fine-grained compilation
information from the emit-module job for incremental compilation to
work with emit-module-separately.
2021-08-13 16:53:42 -07:00
swift-ci
53147b2ccb Merge remote-tracking branch 'origin/main' into rebranch 2021-08-06 14:13:40 -07:00
Artem Chikin
9429136112 [Dependency Scanning] Split the ModuleDependencyCache into two: current scan cache & global.
This change causes the cache to be layered with a local "cache" that wraps the global cache, which will serve as the source of truth. The local cache persists only for the duration of a given scanning action, and has a store of references to dependencies resolved as a part of the current scanning action only, while the global cache is the one that persists across scanning actions (e.g. in `DependencyScanningTool`) and stores actual module dependency info values.

Only the local cache can answer dependency lookup queries, checking current scanning action results first, before falling back to querying the global cache, with queries disambiguated by the current scannning action's search paths, ensuring we never resolve a dependency lookup query with a module info that could not be found in the current action's search paths.

This change is required because search-path disambiguation can lead to false-negatives: for example, the Clang dependency scanner may find modules relative to the compiler's path that are not on the compiler's direct search paths. While such false-negative query responses should be functionally safe, we rely on the current scanning action's results being always-present-in-the-cache for the scanner's functionality. This layering ensures that the cache use-sites remain unchanged and that we get both: preserved global state which can be queried disambiguated with the search path details, and an always-consistent local (current action) cache state.
2021-08-06 09:13:42 -07:00
Arnold Schwaighofer
5a83172a55 Merge remote-tracking branch 'upstream/main' into rebranch 2021-08-05 12:04:56 -07:00
Xi Ge
9a7ac2c5be Frontend: remove -emit-ldadd-cfile-path. NFC
ld should now fully support $ld$previous$, so we shouldn't need this workaround
to generate a C source file to include $ld$add$ definitions.
2021-08-01 15:37:15 -07:00
swift-ci
1538e30794 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-27 15:33:34 -07:00
Ben Barham
12018bebb9 [Frontend] Always output the version being compiled for
Outputting the effective version in the pretty stack trace was skipped
if the current version was the same as the effective version. This would
result in an empty line, which is somewhat confusing. Output a line
regardless.

Resolves rdar://81140703
2021-07-27 11:32:31 +10:00
swift-ci
fa22d03adb Merge remote-tracking branch 'origin/main' into rebranch 2021-07-26 16:53:31 -07:00
Ben Barham
f1c45de2a9 [NFC] Refactor getRenameDecl to use the request evaluator
Move `getRenameDecl` from `PrintAsObjC` into its own request so that
other components can re-use this functionality.
2021-07-24 10:00:02 +10:00
Evan Wilde
685ebd4660 Fix PrintName calls
OptTable::PrintName was renamed 'printName' in commit f1e2d5851bf86.
2021-07-08 16:42:34 -07:00
swift-ci
e0e2634b84 Merge remote-tracking branch 'origin/main' into rebranch 2021-07-06 09:35:07 -07:00
Owen Voorhees
63b03fc858 Print flags of all frontend-integrated tools when -emit-supported-features is passed 2021-07-02 18:18:43 -07:00
Evan Wilde
0aafd09835 F_None was renamed OF_None
This patch updates usages of F_None to OF_None, as LLVM changed that in
commit 3302af9d4c39642bebe64dd60a3aa162fefc44b2.
2021-06-23 10:36:39 -07:00
Ben Barham
599ba8bdbd Add all deserialization fatal output to the pretty stack trace
Rather than outputting diagnostics and to stderr, output all the extra
information added when deserialization fatally fails to the pretty stack
trace instead. Since the pretty stack trace is added to crash logs, this
should avoid the dance of requesting the compiler output

  - Moves the previous "**** DESERIALIZATION FAILURE ..." output to the
    last pretty stack trace line

  - Removes the module and compiler version notes added to the fatal
    diagnostic

  - Adds a new effective compiler version line for all frontend failure.
    Somewhat duplicates the line from the driver, but adds in the
    effective version

  - Adds a new line for the full misc version of the module that failed.
    May double up with previous "While reading from ..." lines that are
    added in various deserialization methods, but better to have it
    twice than not at all
2021-06-04 08:32:07 +10:00
Ben Barham
cbbc29ba62 [Serialization] Add whether allowing errors to the pretty stack output
It's currently not obvious in crash reports whether compiling with
errors is enabled or not. Since this option can make previously
"impossible" paths now possible, add a message to both the pretty stack
output and fatal deserialization diagnostics to point out that it is
enabled.
2021-05-25 09:25:52 +10:00
Ben Barham
747be5899b [Frontend] Do not output swiftinterface when there has been errors
When allowing errors with
-experimental-allow-module-with-compiler-errors, do not output the
.swiftinterface when there has been errors. There's no real need to
output them for invalid modules, so this avoids module interface
printing having to have checks for normally-impossible cases.

Resolves rdar://78039608.
2021-05-20 11:48:05 +10:00
Xi Ge
b6cd513534 Frontend: teach the compiler to use a backup directory to find .swiftinterface files to compile
This mechanism allows the compiler to use a backup interface file to build into a binary module when
a corresponding interface file from the SDK is failing for whatever reasons. This mechansim should be entirely opaque
to end users except several diagnostic messages communicating backup interfaces are used.

Part of rdar://77676064
2021-05-13 09:11:45 -07:00
Owen Voorhees
07fb294c8a [APIDigester] Provide a category when serializing diagnostics representing API or ABI breakage 2021-05-04 19:35:35 -07:00
Alexis Laferrière
758351110a [Sema] Allow the use of SPI in API for SPI modules
When the whole module has an SPI distribution, SPI declarations can be
used in API.

rdar://75335462
2021-04-20 15:02:51 -07:00
Varun Gandhi
cc14992281 [Frontend] Add -emit-irgen option to driver and frontend.
Fixes SR-14389, fixes rdar://75715690.
2021-03-31 11:56:36 -07:00
Ben Barham
a17593f026 [Frontend] Always output swiftdeps when allowing errors
A module is always output when allowing errors, make sure to output its
dependencies as well.
2021-03-25 16:19:09 +10:00
Ben Barham
ab5a42160c [Frontend] Always emit generated ObjectiveC header when allowing errors
Resolves rdar://75754282
2021-03-25 16:19:09 +10:00
Michael Gottesman
504b5f2058 [ossa][frontend] Separately namespace enable-ossa-modules in the prebuilt module cache so that the flag causes recompilation of imported resilient modules when the flag is enabled.
This will enable users to try out the '-enable-ossa-modules' flag if their
compiler supports it and get OSSA code on all inlinable code that they use. The
idea is that this is a nice way to stage this in and get more testing.

The specific implementation is that the module interface loader:

1. Knows if enable ossa modules is enabled not to search for any compiled
modules. We always rebuild from the interface file on the system.

2. Knows that if enable ossa modules is enabled to mixin a bit into the module
interface loader cache hash to ensure that we consider the specialized ossa
compiled modules to be different than the modules in that cache from the system.

This ensures that when said flag is enabled, the user transparently gets all
their code in OSSA form from transparent libraries.
2021-03-18 13:03:51 -07:00
Robert Widmann
7f7978370b Merge pull request #36111 from CodaFi/cross-over-episode
Add Real Enable/Disable Flags for Cross-Module Incremental Builds
2021-03-02 16:07:11 -08:00
Robert Widmann
28a37a427f Add Real Enable/Disable Flags for Cross-Module Incremental Builds
In the legacy driver, these flags will merely be propagated to the
frontends to indicate that they should disable serialization of
incremental information in swift module files.

In the new driver, these flags control whether the Swift driver performs
an incremental build that is aware of metadata embedded in the module.

Kudos to David for coming up with our new marketing name: Incremental
Imports.

rdar://74363450
2021-03-01 10:15:25 -08:00
Nathan Hawes
821345c834 [Frontend] Add a new -index-unit-ouput-path and filelist equivalent to the frontend
These new options mirror -o and -output-filelist and are used instead
of those options to supply the output file path(s) to record in the
index store. This is intended to allow sharing index data across
builds in separate directories that are otherwise equivalent as far
as the index data is concered (e.g. an ASAN build and a non-ASAN build)
by supplying the same -index-unit-output-path for both.

Resolves rdar://problem/74816412
2021-02-27 13:06:22 +10:00
Varun Gandhi
f9570b2d34 [NFC] Pass full convention printing boolean for types etc.
When -experimental-print-full-convention is set, we should be printing
the full convention in diagnostics, doc comments etc.
2021-01-25 18:47:39 -08:00
Robert Widmann
cc0d919653 Remove Compiled Source 2021-01-13 23:00:16 -08:00
Robert Widmann
2475095021 Remove Ranges File Type 2021-01-13 22:42:17 -08:00
Robert Widmann
9d06eef2a6 Close Soundness Hole in Incremental Build
Fix a longstanding bug in the driver where the incremental build would
fail to execute dependent jobs and allow errors in primaries in later
waves to become buried. A simplified version of a situation that exposes
this bug has been committed into the tests.

Imagine two files:

```
// one.swift

struct A {}

// two.swift

func use() {
  let _ = A()
}
```

After a clean build, we modify one.swift as follows:

```
// one.swift

struct B< {}
```

The syntax error in this file caused the baseline driver to fail the
build immediately and thus we would not schedule two.swift for
execution. This is incorrect! Consider correcting the syntax error in
one.swift:

```
// one.swift

struct B {}
```

two.swift _still_ won't be rebuilt because
1) It was never modified during any step of this process
2) The swiftdeps of two.swift have not been updated to flush out the
   dependency on A.

rdar://72800626
2021-01-12 19:07:43 -08:00
Artem Chikin
082fc48b25 [Dependency Scanning] Refactor dependency scanner to return an in-memory format as a result
This commit refactors ScanDependencies.cpp to split the functionality into two functional groups:
- Scan execution code that performs the mechanics of the scan and produces an in-memory result
- Dependency scanner entry-points used when the scanning action is invoked as a `swift-frontend` execution mode
This commit also adds the aforementioned in-memory dependency scanning result in `FullDependencies.h`, modeled after the InterModuleDependencyGraph representation in swift-driver
2021-01-07 09:08:20 -08:00
Artem Chikin
dad14358fb [Dependency Scanning] Factor out import prescan into separate utility 2021-01-07 09:08:20 -08:00
Artem Chikin
aabcb22df1 Rename SwiftScan directory into DependencyScan 2021-01-07 09:08:20 -08:00
Artem Chikin
79d559e361 [Dependency Scanning] Deprecate and remove -scan-clang-dependencies
Since it was introduced, its use-case has been entirely subsumed by batch scanning.
2021-01-07 09:08:20 -08:00
Artem Chikin
07e07a1d8c [Dependency Scanning] Add DependencyScanningTool entry-point for batch scanning 2021-01-07 09:08:20 -08:00
Artem Chikin
7d1d8a4661 [Dependency Scanning] Factor ModuleDependenciesCache out of a CompilerInstance into callers of scanDependencies
It is now the responsibility of the scanDependencies code to instantiate (and share) the cache.
e.g. FrontendTool instantiates a new cache per `-scan-dependencies` invocation, and the DependencyScanningTool keeps one shared cache across its lifetime.
2021-01-07 09:08:20 -08:00
Artem Chikin
f3d217edc3 [Dependency Scanning] Add a C++ itnerface for a tool that answers dependency-scanning queries. 2021-01-07 09:08:20 -08:00
Slava Pestov
e675bee26c AST: Split off DependencyCollector.h from EvaluatorDependencies.h
Also remove some unnecessary #includes from DependencyCollector.h,
which necessitated adding #includes in various other files.
2020-12-23 00:00:25 -05:00
Artem Chikin
915186ab47 Refactor Basic/Parseable-Output to remove dependency on Driver & Frontend
Introducing new entry-points that can be used from both Driver and Frontend clients, using an intermediary new type: `DetailedMessagePayload`, when needed.
2020-12-14 11:35:56 -08:00
Artem Chikin
269f1b91bc Add host-specific include for getpid() in FrontendTool. 2020-12-11 16:01:04 -08:00
Artem Chikin
86e039f21c Suppress the output of the PrintingDiagnosticConsumer when in Frontend Parseable-Output mode 2020-12-11 16:01:04 -08:00
Artem Chikin
942cb0855e Implement frontend parseable-output batch job quasi-PID assignment.
Starting at a crude -1000, each invocation primary input will get its own unique quasi-Pid.
Invocations with only one primary (non-batch) will get a real OS Pid.

The selection of the constant starting point matches what the driver does when outputting its parseable output.
2020-12-11 16:01:04 -08:00
Artem Chikin
23e374ce78 Add support for emitting parseable-output "finished" message and per-primary messages for batched jobs
Inside swift-frontend
2020-12-11 16:01:03 -08:00
Robert Widmann
76d25e7097 [NFC] Fixup InputFile Convenience Getters
Follow programming guidelines for these getters more closely and have them return a non-owning view of the underlying data instead of relying on callers to take const references to the copy that is returned here.
2020-11-12 14:54:02 -08:00
Robert Widmann
a89f8e04d6 [NFC] Drop Unused Includes from FrontendTool 2020-11-12 14:54:02 -08:00