Commit Graph

751 Commits

Author SHA1 Message Date
Owen Voorhees
e40e86fc94 Merge pull request #32017 from owenv/diag-style-opt
[Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
2020-05-27 20:22:23 -07:00
swift_jenkins
35191fe8b9 Merge remote-tracking branch 'origin/master' into master-next 2020-05-27 18:58:55 -07:00
Hamish Knight
bccdc0e062 NFC: Rename performSILGeneration -> performASTLowering
And also rename the underlying request and
descriptor.

This rename is motivated by the fact that the
operation may instead perform parsing of SIL files
and/or deserialization of SIB files.
2020-05-27 09:36:11 -07:00
swift_jenkins
69b940a8d3 Merge remote-tracking branch 'origin/master' into master-next 2020-05-22 20:58:53 -07:00
Robert Widmann
acbf927b0e [NFC] Delete ReferencedNameTracker 2020-05-21 18:54:14 -07:00
Owen Voorhees
c4e67e29ed [Diagnostics] Add -diagnostic-style=(llvm|swift) to control printed output
This default formatting style remains the same "LLVM style". "Swift style"
is what was previously enabled via -enable-experimental-diagnostic-formatting
2020-05-20 19:34:15 -05:00
swift_jenkins
10e1981971 Merge remote-tracking branch 'origin/master' into master-next 2020-05-13 13:37:47 -07:00
Robert Widmann
d82880a274 Merge pull request #31721 from CodaFi/const-of-proportionality
Const-Qualify LangOptions and TypeCheckerOptions
2020-05-13 13:36:15 -07:00
swift_jenkins
0fbb11da7a Merge remote-tracking branch 'origin/master' into master-next 2020-05-13 11:17:46 -07:00
Robert Widmann
eac92e3df0 [NFC] Const-Qualify LangOptions Accesses Through ASTContext 2020-05-13 09:13:44 -07:00
Slava Pestov
a301808144 Frontend: Go back to emitting index data after IRGen
There's no longer a technical reason to do this, but it helps
with crash analytics because AST crashes are less likely to
end up happening during index emission.
2020-05-13 00:27:54 -04:00
Arnold Schwaighofer
e12698d7a0 Merge remote-tracking branch 'origin/master' into master-next 2020-05-08 07:22:20 -07:00
Hamish Knight
98d3a81ede Merge pull request #31609 from hamishknight/ill-sil-you-in-later 2020-05-07 18:02:52 -07:00
swift_jenkins
8069dd1be9 Merge remote-tracking branch 'origin/master' into master-next 2020-05-07 08:20:47 -07:00
Hamish Knight
70abfd3252 [Frontend] Remove TheSILModule
Now that SIL parsing is handled lazily, the
CompilerInstance no longer needs to hang onto a
SILModule.
2020-05-06 20:11:49 -07:00
Hamish Knight
11d8f70dec Trigger SIL parsing from performSILGeneration
Rather than eagerly parsing an input .sil file
in `performSemaUpTo`, trigger it from
`performSILGeneration`. This will allow us to
remove the SILModule stored on the
CompilerInstance and will eventually allow the
various SIL tools to just call into
`performSILGeneration` without needing to call
`performSema`.
2020-05-06 20:11:48 -07:00
Slava Pestov
dd0ce1ad13 Remove the integrated REPL 2020-05-06 22:29:05 -04:00
swift_jenkins
d4f39f3eaa Merge remote-tracking branch 'origin/master' into master-next 2020-05-06 19:26:08 -07:00
Slava Pestov
5b6aa8d3d1 Frontend: Emit reference dependencies at the end of the frontend pipeline
As part of eliminating cascading dependencies, we need to make sure to
capture any dependencies discovered during SILGen and IRGen.

This is a little bit tricky because we exit early in various places in
the pipeline, so we want to do it after performCompileStepsPostSema()
returns, but we can't do it too late, because the ASTContext might
already have been deallocated.

So emit the dependencies manually before freeing the ASTContext if we
decide to do that, or just do it before returning from performCompile()
using a SWIFT_DEFER otherwise.

This should have no observable effect until we start recording dependencies
for lookups done on behalf of declarations in secondary files.
2020-05-06 18:42:37 -04:00
swift_jenkins
2af7cfcffe Merge remote-tracking branch 'origin/master' into master-next 2020-05-05 16:18:50 -07:00
Robert Widmann
b06211eac4 Initial plumbing for private dependencies
Add a mode bit to the dependency collector that respects the frontend flag in the previous commit.

Notably, we now write over the dependency files at the end of the compiler pipeline when this flag is on so that dependency from SILGen and IRGen are properly written to disk.
2020-05-05 13:48:25 -07:00
Robert Widmann
a082e9de26 [Gardening] Use the CompilerInstance's DiagnosticEngine
This keeps us honest about the const-ness of the CompilerInstance itself: emitting diagnostics is a transitively mutating operation.
2020-05-05 12:56:59 -07:00
swift_jenkins
9b6f01b6d9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-30 20:37:34 -07:00
Daniel Sweeney
ea526c6383 Converting ModuleDecl::ImportedModule from std::pair to a dedicated struct. (#31360) 2020-04-30 20:26:03 -07:00
swift_jenkins
2fb0e14746 Merge remote-tracking branch 'origin/master' into master-next 2020-04-29 21:48:41 -07:00
Hamish Knight
f7ae7c0459 [Frontend] Avoid passing CompilerInvocation + CompilerInstance
The invocation can be retrieved from the
CompilerInstance.
2020-04-29 18:58:47 -07:00
swift_jenkins
4dc2e3c785 Merge remote-tracking branch 'origin/master' into master-next 2020-04-29 17:59:15 -07:00
Slava Pestov
fd9ffe70d8 Frontend: Write out index before SILGen
This cleans things up somewhat.

Fixes <rdar://problem/30433353>.
2020-04-29 19:20:40 -04:00
Slava Pestov
368d47429d Frontend: Remove coarse-grained dependency graph implementation 2020-04-29 16:55:53 -04:00
swift_jenkins
34a33d9972 Merge remote-tracking branch 'origin/master' into master-next 2020-04-25 09:58:23 -07:00
Saleem Abdulrasool
618ced846b Merge pull request #31310 from compnerd/unreachable
sprinkle some `llvm_unreachable` for MSVC (NFC)
2020-04-25 09:44:39 -07:00
swift_jenkins
ed20b9c058 Merge remote-tracking branch 'origin/master' into master-next 2020-04-24 23:58:13 -07:00
Saleem Abdulrasool
fa46f7131c sprinkle some llvm_unreachable for MSVC (NFC)
MSVC does not realize that the switch is exhaustive and requires that
the path is explicitly marked as unreachable.  This silences the C4715
warning ("not all control paths return a value").
2020-04-24 18:59:07 -07:00
Doug Gregor
71e7d6a913 [Dependency scanning] Add implicit Swift and SwiftOnoneSupport dependencies 2020-04-24 12:58:45 -07:00
Doug Gregor
08ec8781aa [Dependency scanning] Emit make-style dependency files.
If requested, produce the normal make-style dependency file from the
fast dependency scanner, using the same dependency-tracking
infrastructure.
2020-04-24 12:58:44 -07:00
Doug Gregor
33cdd61835 Fast dependency scanning for Swift
Implement a new "fast" dependency scanning option,
`-scan-dependencies`, in the Swift frontend that determines all
of the source file and module dependencies for a given set of
Swift sources. It covers four forms of modules:

1) Swift (serialized) module files, by reading the module header
2) Swift interface files, by parsing the source code to find imports
3) Swift source modules, by parsing the source code to find imports
4) Clang modules, using Clang's fast dependency scanning tool

A single `-scan-dependencies` operation maps out the full
dependency graph for the given Swift source files, including all
of the Swift and Clang modules that may need to be built, such
that all of the work can be scheduled up front by the Swift
driver or any other build system that understands this
option. The dependency graph is emitted as JSON, which can be
consumed by these other tools.
2020-04-24 12:58:41 -07:00
swift_jenkins
c2672fe6e9 Merge remote-tracking branch 'origin/master' into master-next 2020-04-19 23:58:17 -07:00
swift_jenkins
563adf9573 Merge remote-tracking branch 'origin/master' into master-next 2020-04-19 21:57:18 -07:00
Robert Widmann
37f016b802 [NFC] Formalize isModuleExternallyConsumed
Yank this parameter and document the historical scope creep of this value.
2020-04-19 21:46:59 -07:00
Robert Widmann
446c6e6682 [NFC] Refactor validateTBDIfNeeded
Inline the conditions for the astGuaranteedToCorrespondToSIL parameter and clean up the logic here to be more const-friendly. Also try to centralize and document the reasons we skip TBD validation.
2020-04-19 16:10:06 -07:00
Robert Widmann
5481631baf Merge remote-tracking branch 'upstream/master' into master-next 2020-04-17 20:27:23 -07:00
Robert Widmann
2ca8e66770 [NFC] Refactor the construction of SILRemarksStreamer
The Remarks Streamer's installation seemed a bit overly complex, so simplify it in a few places:

* Refactor sil-opt to install the remarks options into the SILOptions for the SILModule

This reduces the parameter bloat in createSILRemarkStreamer. All of this data is freely derivable from the SILModule alone.

* Refactor createSILRemarkStreamer into SILRemarkStreamer::create

With the new reduction in parameters, we can hide the internal constructor and introduce a smart constructor that vends a unique pointer to clients.

* setSILRemarkStreamer -> installSILRemarkStreamer

Since the information to create a streamer is now entirely derivable from a module, remove a layer of abstraction and have the module directly construct a streamer for itself.

* Give SILRemarkStreamer its own LLVMContext

The remarks streamer just needs scratch space. It's not actually "installed" in a given context. There no reason to use Swift's Global Context here.

* Give the SILRemarkStreamer ownership of the underlying file stream

The SILModule didn't actually use this member, and it seems like somebody needs to own it, so just give it to the remarks streamer directly.
2020-04-17 14:02:45 -07:00
Robert Widmann
bc31c7fe47 [NFC] Internalize the LLVMContext for LLVM IR Code Generation 2020-04-17 12:22:36 -07:00
Robert Widmann
993c35dcd6 Merge remote-tracking branch 'upstream/master' into contextual-clues 2020-04-17 11:52:53 -07:00
Robert Widmann
85fdc7a555 Merge pull request #31080 from CodaFi/why-I-R-ta
Give IRGenModule Ownership of its LLVMContext
2020-04-17 10:32:46 -07:00
swift_jenkins
88d5c0a16e Merge remote-tracking branch 'origin/master' into master-next 2020-04-17 07:19:05 -07:00
Michael Forster
fae87c96d7 Move interleave(...) to the llvm namespace
This simplifies fixing the master-next build. Upstream LLVM already
has a copy of this function, so on master-next we only need to delete
the Swift copy, reducing the potential for merge conflicts.
2020-04-17 11:20:50 +02:00
Robert Widmann
de304b5bee [NFC] Introduce GeneratedModule
swift::GeneratedModule encapsulates an llvm::Module, llvm::LLVMContext
pair that must live and die together. It has  convenient accessors for
projecting the module and context components. The meat of this type is
the two conversion functions, which transfer ownership of either the
module component to the caller or the module and context to ORCJIT.

This is because ORC enforces an ownership contract that is distinct from
LLVM's rather wild ownership story for modules and their associated
contexts. See http://llvm.org/docs/ORCv2.html#how-to-use-threadsafemodule-and-threadsafecontext
2020-04-16 11:57:44 -07:00
David Ungar
9dcd2b52b2 Allocate LLVMContext in IRGenModule. 2020-04-16 11:57:44 -07:00
swift_jenkins
12a5da6dc6 Merge remote-tracking branch 'origin/master' into master-next 2020-03-31 18:24:02 -07:00