Commit Graph

32 Commits

Author SHA1 Message Date
Erik Eckstein
2f124cf564 Remove the -enable-ossa-modules option.
OSSA modules are enabled by default.
The compiler still accepts this option but it has no effect.
2025-09-26 08:01:08 +02:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Kavon Farvardin
149c052ec5 use new noncopyable types infrastructure
The infrastructure underpinning the new feature NoncopyableGenerics is
mature enough to be used.
2024-03-14 23:10:44 -07:00
Kavon Farvardin
483b569bc8 [NCGenerics] trigger module mismatch
A swiftmodule can only be correctly ingested by a compiler
that has a matching state of using or not-using
NoncopyableGenerics.

The reason for this is fundamental: the absence of a Copyable
conformance in the swiftmodule indicates that a type is
noncopyable. Thus, if a compiler with NoncopyableGenerics
reads a swiftmodule that was not compiled with that feature,
it will think every type in that module is noncopyable.

Similarly, if a compiler with NoncopyableGenerics produces a
swiftmodule, there will be Copyable requirements on each
generic parameter that the compiler without the feature will
become confused about.

The solution here is to trigger a module mismatch, so that
the compiler re-generates the swiftmodule file using the
swiftinterface, which has been kept compatible with the compiler
regardless of whether the feature is enabled.
2024-01-23 22:42:37 -08:00
Adrian Prantl
5ef93af269 Revert "Don't require a strict revision match in LLDB."
This reverts commit 3cc2831608.

The compiler's revision check has been relaxed since the feature was introduced
and so it's nos better to reduce the number of special code paths for LLDB in
the compiler to facilitate reasoning about it.

rdar://117824367
2023-12-06 11:14:14 -08:00
Adrian Prantl
5d978b44ca Revert "Revert "Make the DWARF version emitted by the Swift compiler configurable."" 2023-10-26 12:29:18 -07:00
Adrian Prantl
2a32ca5944 Revert "Make the DWARF version emitted by the Swift compiler configurable." 2023-10-25 13:28:28 -07:00
Adrian Prantl
d19fe381fa Use LLVM definitions for Swift section names (NFC) 2023-10-24 10:58:40 -07:00
Hiroshi Yamauchi
24dfc905f5 [lldb] Capture error messages from parseASTSection to log from the caller.
This helps fix a lldb console output mixup between the lldb logging
and the llvm::dbgs() messages from parseASTSection.
2023-08-10 17:08:25 -07:00
Adrian Prantl
a3a43d46c5 [Serialization] Teach ASTSectionImporter to filter by triple.
On macOS it is possible for one application to contain Swift modules compiled
for different triples that are incompatible as far as the Swift compiler is
concerned. Examples include an iOS simulator application hunning on a macOS
host, or a macCatalyst application running on macOS. A debugger might see
.swift_ast sections for all triples at the same time. This patch adds an
interface to let the client provide a triple to filter Swift modules in an
ASTSection.

rdar://107869141
2023-05-08 08:32:00 -07:00
Adrian Prantl
3cc2831608 Don't require a strict revision match in LLDB.
For release-management purposes during development, LLDB's embedded Swift
compiler's version number can sometimes be off-by-one in the last digit
compared to the Swift compiler.

This patch restores the old behavior from before 17183629e4.

rdar://101299168
2022-10-19 09:03:13 -07:00
Alexis Laferrière
c8059a09e9 [Serialization] Soft-reject swiftmodules built against a different SDK
Change the way swiftmodules built against a different SDK than their
clients are rejected. This makes them silently ignored when the module
can be rebuilt from their swiftinterface, instead of reporting a hard
error.

rdar://93257769
2022-05-16 13:22:35 -07:00
Meghana Gupta
f458d9b490 Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag

This includes a bit in the module format to represent if the module was
compiled with -enable-ossa-modules flag. When compiling a client module
with -enable-ossa-modules flag, all dependent modules are checked for this bit,
if not on, recompilation is triggered with -enable-ossa-modules.

* Updated tests
2021-10-04 18:46:40 -07:00
Xi Ge
8fa2e8a03d ModuleLoader: teach canImport to check Swift user module versions
For config condition `canImport(Foo, version: N)`, this patch teaches the compiler to check N
against the version of the Swift module Foo on disk. It returns true if the module version on
disk is greater or equal to N and returns false otherwise.

Part of rdar://73992299
2021-05-03 14:04:01 -07:00
Fred Riss
259d78a350 Adapt to llvm.org StringRef API change 2020-03-13 19:08:22 +01:00
Adrian Prantl
bdc1eec983 Use the same alignment for writing and readin .swift_ast section contents.
This fixes a bug that made it impossible to read any subsequent Swift modules
out of a .swift_ast section a previous section had a size divisible by 4.

rdar://problem/57110020
2019-12-04 14:39:12 -08: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
Brian Gesiak
3b75c060ff [AST] Fix typo in debug output
When ASTSectionImporter is unable to load a module Foo, it outputs
`Unable to load module'Foo'.`. Note that there's no space between
"module" and "'Foo'". Add a colon and a space.
2017-10-18 12:31:11 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Jordan Rose
dbd3b60f6b [Serialization] Move (Module)Status and validateSerializedAST into a namespace.
Also into a separate file.

Before (swift/Serialization/SerializedModuleLoader.h):
  ModuleStatus
  SerializedModuleLoader::ValidationInfo
  SerializedModuleLoader::ExtendedValidationInfo
  SerializedModuleLoader::isSerializedAST
  SerializedModuleLoader::validateSerializedAST

After (swift/Serialization/Validation.h):
  serialization::Status
  serialization::ValidationInfo
  serialization::ExtendedValidationInfo
  serialization::isSerializedAST
  serialization::validateSerializedAST

No functionality change, just a lot of renaming and a bit of reorganizing.

Swift SVN r25226
2015-02-12 05:32:25 +00:00
Jordan Rose
2c13b2e6fe Remove SwiftASTStreamerPass and the LegacyDebugInfo option.
Finishes the removal of the old "wrapped" module section that was made
unnecessary in r12922/3. Now that we no longer use the old compiler, we
don't need this at all. That also removes the need for SwiftTargetMachine.

No functionality change; this was all dead code.

Swift SVN r14758
2014-03-06 22:05:03 +00:00
Jordan Rose
cc3119be51 Teach the Mach-O-based AST importer to accept bare serialized ASTs.
This necessitated adding a new function to validate a serialized AST, so
that we can get the same information that used to be extracted from the
section header.

For now, we'll continue accepting the wrapped ASTs as well, since we
haven't changed the existing debug info generator.

Swift SVN r12922
2014-01-24 18:42:07 +00:00
Jordan Rose
e54deeb3c5 [serialization] Add missing headers to .cpp file.
Relying on the order of includes is a Bad Thing. No functionality change.

Swift SVN r12920
2014-01-24 18:42:04 +00:00
Adrian Prantl
9bd48f8557 Bugfix. Thanks for catching this, Jordan.
Swift SVN r9326
2013-10-14 20:29:39 +00:00
Adrian Prantl
3d9b27bcfc Debug info: Don't require 0-termination in the membuffer.
Thanks to Greg for finding this.

Swift SVN r8360
2013-09-17 22:21:21 +00:00
Adrian Prantl
e3b30dbbf9 Silence a couple more warnings.
Swift SVN r8347
2013-09-17 20:29:13 +00:00
Adrian Prantl
b34d631aaf Debug info: Implement multi-module swift ASTSections.
When multiple swift .o files are linked, ld automatically concatenates
the swift/AST sections.
Updated section header, SwiftASTstreamer, ASTSectionImporter, and
lldb-moduleimport-test to support this feature.

Swift SVN r8325
2013-09-17 02:50:54 +00:00
Adrian Prantl
d7c64060cf Debug info: Don't copy the memory for a serialized swift module in an __ast
section. Thanks to Jordan for pointing this out.
No functionality change.

Swift SVN r8022
2013-09-07 00:44:32 +00:00
Adrian Prantl
e77baa78b7 Rename __DWARF/__apple_ast segment and section to __SWIFT/__ast so the
linker doesn't discard it.

Swift SVN r7958
2013-09-05 20:46:34 +00:00
Adrian Prantl
2063a27aea Relocate Mach-O AST section parsing from SerializedModuleLoader/ to ASTSectionImporter/.
Swift SVN r7869
2013-09-03 21:56:53 +00:00