Commit Graph

1832 Commits

Author SHA1 Message Date
Ben Barham
8c7f331ba7 Merge pull request #63339 from bnbarham/wd-hack
[Frontend] Split -working-directory<path>
2023-02-01 14:16:47 -08:00
Ben Barham
b5caa97b6b [Frontend] Split -working-directory<path>
Clang no longer supports `-working-directory<path>`. Split this argument
into `-working-directory <path>` so that clients passing the old
argument still work.
2023-01-31 16:17:11 -08:00
swift-ci
ef62fdf232 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-31 11:53:53 -08:00
Doug Gregor
8871129896 [Macros] Add frontend flag to dump macro expansions for diagnostics.
Add frontend flag `-emit-macro-expansion-files diagnostics` to emit any
macro expansion buffers referenced by diagnostics into files in a
temporary directory. This makes debugging type-checking failures in
macro expansions far easier, because you can see them after the
compiler process has exited.
2023-01-30 18:05:53 -08:00
swift-ci
df75f6ee09 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-25 22:33:52 -08:00
swift-ci
281088eb73 Merge pull request #63204 from meg-gupta/ptrauthcodegenpr
Initial support for ptrauth qualified function pointers in C
2023-01-25 22:19:34 -08:00
Meghana Gupta
a515e0db8e Add EnableImportPtrauthFieldFunctionPointers flag 2023-01-25 12:37:57 -08:00
Erik Eckstein
87ed8b4dc3 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-24 08:58:16 +01:00
Doug Gregor
fa845d8eb2 Merge pull request #63153 from DougGregor/swift-syntax-diagnostic-style
[Diagnostics] Add a swift-syntax diagnostic style
2023-01-22 13:44:14 -08:00
Doug Gregor
bdf1183757 [Diagnostics] Add a swift-syntax diagnostic style
The SwiftDiagnostics module within swift-syntax has a diagnostic
pretty-printer that does a nice rendering of the source code with
diagnostics placed inside gaps between the code lines.
Introduce another `-diagnostic-style` argument, `swift-syntax`,
to bridge from the pretty-printed C++ diagnostics over to the
swift-syntax diagnostics engine.
2023-01-21 23:09:56 -08:00
swift-ci
5388055f12 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-19 09:14:10 -08:00
Arnold Schwaighofer
8a38738abf IRGen: Initial support for relative protocol witness table emission 2023-01-18 13:43:25 -08:00
Erik Eckstein
712fd7922b Merge remote-tracking branch 'origin/main' into rebranch 2023-01-09 08:48:47 +01:00
Alexis Laferrière
d1343c86fb [Frontend] Intro flags to control deserialization safety
Deserialization safety remains off by default at the moment.
2023-01-06 12:02:47 -08:00
swift-ci
dcfb01cfb3 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-13 09:16:29 -08:00
Alexis Laferrière
010973c276 [Frontend|NFC] Rename ModuleInterfaceOptions::PrintPrivateInterfaceContent 2022-12-08 15:10:03 -08:00
Ben Barham
68d5d1f9ca Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
  lib/Frontend/CompilerInvocation.cpp - legacy pass manager removed
2022-12-07 10:13:47 -08:00
Arnold Schwaighofer
39e5e3990d IRGen: Co-locate metadata instatiation/completions/accessor functions in a special section
For spatial locality on startup.

Hide collocating metadata functions in a separate section behind a flag.
The default is not to collocate functions.

rdar://101593202
2022-12-05 09:52:04 -08:00
swift-ci
4e20be1f15 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-01 01:34:17 -08:00
Franklin Schrans
d3e96590d9 Merge pull request #61637 from theMomax/extension-block-symbols-deactivation-flag
Make emission of extension block symbols a formal feature
2022-12-01 08:18:24 +01:00
Erik Eckstein
d89c6b2d70 Merge remote-tracking branch 'origin/main' into rebranch 2022-12-01 07:48:51 +01:00
Dario Rexin
3cf40ea504 [IRGen] Re-introduce TypeLayout strings (#62059)
* Introduce TypeLayout Strings

Layout strings encode the structure of a type into a byte string that can be
interpreted by a runtime function to achieve a destroy or copy. Rather than
generating ir for a destroy/assignWithCopy/etc, we instead generate a layout
string which encodes enough information for a called runtime function to
perform the operation for us. Value witness functions tend to be quite large,
so this allows us to replace them with a single call instead. This gives us the
option of making a codesize/runtime cost trade off.

* Added Attribute @_GenerateLayoutBytecode

This marks a type definition that should use generic bytecode based
value witnesses rather than generating the standard suite of
value witness functions. This should reduce the codesize of the binary
for a runtime interpretation of the bytecode cost.

* Statically link in implementation

Summary:
This creates a library to store the runtime functions in to deploy to
runtimes that do not implement bytecode layouts. Right now, that is
everything. Once these are added to the runtime itself, it can be used
to deploy to old runtimes.

* Implement Destroy at Runtime Using LayoutStrings

If GenerateLayoutBytecode is enabled, Create a layout string and use it
to call swift_generic_destroy

* Add Resilient type and Archetype Support for BytecodeLayouts

Add Resilient type and Archetype Support to Bytecode Layouts

* Implement Bytecode assign/init with copy/take

Implements swift_generic_initialize and swift_generic_assign to allow copying
types using bytecode based witnesses.

* Add EnumTag Support

* Add IRGen Bytecode Layouts Test

Added a test to ensure layouts are correct and getting generated

* Implement BytecodeLayouts ObjC retain/release

* Fix for Non static alignments in aligned groups

* Disable MultiEnums

MultiEnums currently have some correctness issues with non fixed multienum
types. Disabling them for now then going to attempt a correct implementation in
a follow up patch

* Fixes after merge

* More fixes

* Possible fix for native unowned

* Use TypeInfoeBasedTypeLayoutEntry for all scalars when ForceStructTypeLayouts is disabled

* Remove @_GenerateBytecodeLayout attribute

* Fix typelayout_based_value_witness.swift

Co-authored-by: Gwen Mittertreiner <gwenm@fb.com>
Co-authored-by: Gwen Mittertreiner <gwen.mittertreiner@gmail.com>
2022-11-29 21:05:22 -08:00
swift-ci
efef52a86e Merge remote-tracking branch 'origin/main' into rebranch 2022-11-28 09:33:40 -08:00
Erik Eckstein
ab1b343dad use new llvm::Optional API
`getValue` -> `value`
`getValueOr` -> `value_or`
`hasValue` -> `has_value`
`map` -> `transform`

The old API will be deprecated in the rebranch.
To avoid merge conflicts, use the new API already in the main branch.

rdar://102362022
2022-11-21 19:44:24 +01:00
Rintaro Ishizaki
d458c8b74a Merge remote-tracking branch 'origin/main' into rebranch
Conflicts:
	include/swift/Sema/ConstraintSystem.h
	include/swift/Syntax/AbsoluteRawSyntax.h
	include/swift/Syntax/Syntax.h
	include/swift/Syntax/SyntaxData.h
	lib/DependencyScan/ModuleDependencyCacheSerialization.cpp
	lib/Syntax/SyntaxFactory.cpp.gyb
	lib/Syntax/SyntaxNodes.cpp.gyb
	tools/SourceKit/lib/SwiftLang/SwiftEditor.cpp
	tools/swift-syntax-test/swift-syntax-test.cpp
2022-11-18 09:37:38 -08:00
Alexis Laferrière
9f34fa3601 Merge pull request #62148 from xymus/library-level-ipi-intro
[Sema] Accept and store the IPI library-level
2022-11-17 13:34:27 -08:00
Alexis Laferrière
a926b0555b [Sema] Accept and store the IPI library-level
Prepare to accept the `ipi` argument to the `-library-level` flag. IPI
stands for Internal Programming Interface and would describe a module
that's not to be distributed outside of its project.

In the future, the compiler could use that information to report when a
distributed module (api or spi) imports publicly a module that's not
distributed.

rdar://102435183
2022-11-16 16:29:56 -08:00
Robert Widmann
37e7052c68 Remove -emit-syntax and -verify-syntax-tree 2022-11-16 15:07:48 -08:00
swift-ci
c2e69c2370 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-15 21:54:13 -08:00
Doug Gregor
0bc94509f2 Merge pull request #62107 from DougGregor/dump-macro-expansions 2022-11-15 21:48:01 -08:00
Doug Gregor
f2f974bb94 [Macros] Add a flag -dump-macro-expansions as a debugging aid. 2022-11-14 21:31:29 -08:00
swift-ci
e65fa9c45d Merge remote-tracking branch 'origin/main' into rebranch 2022-11-11 22:52:44 -08:00
eeckstein
ddc69e7d0d Merge pull request #62057 from eeckstein/enable-stack-protection
SILOptimizer: enable stack protection by default
2022-11-12 07:38:19 +01:00
swift-ci
873f636d9a Merge remote-tracking branch 'origin/main' into rebranch 2022-11-11 14:13:49 -08:00
Holly Borla
3dad05301d Merge pull request #62064 from hborla/experimental-feature-flags
[FrontendOptions] Remove bespoke experimental feature flags in favor of `-enable-experimental-feature X`.
2022-11-11 14:06:44 -08:00
swift-ci
ca8635e2f6 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-11 12:03:33 -08:00
Alexis Laferrière
b526205f42 Merge pull request #62044 from xymus/module-alias-disambiguate-fix
[ModuleInterface] Support loading an aliased module with an underlying module
2022-11-11 11:55:44 -08:00
Holly Borla
c1dcb9c6f1 [FrontendOptions] Remove bespoke experimental feature flags for ImplicitSome and
VariadicGenerics in favor of -enable-experimental-feature X.
2022-11-11 10:14:08 -08:00
Erik Eckstein
ef302ce4ac SILOptimizer: enable stack protection by default
The pass to decide which functions should get stack protection was added in https://github.com/apple/swift/pull/60933, but was disabled by default.

This PR enables stack protection by default, but not the possibility to move arguments into temporaries - to keep the risk low.
Moving to temporaries can be enabled with the new frontend option `-enable-move-inout-stack-protector`.

rdar://93677524
2022-11-11 17:14:08 +01:00
Alexis Laferrière
0e40dac015 [ModuleInterface] Introduce env var to test the module-alias workaround
Set the env var SWIFT_ALIAS_MODULE_NAMES_IN_INTERFACES to turn on
generating swiftinterfaces with the AliasModuleNames workaround by
default.
2022-11-10 16:32:50 -08:00
swift-ci
b3d9c1efd3 Merge remote-tracking branch 'origin/main' into rebranch 2022-11-07 09:35:16 -08:00
Alexis Laferrière
e550944826 Merge pull request #61941 from xymus/module-alias-disambiguate
[ModuleInterface] Avoid ambiguities in swiftinterfaces by writing aliases for module names
2022-11-07 08:46:32 -08:00
Erik Eckstein
2653264b3c IRGen: remove the legacy pass manager 2022-11-04 20:44:18 +01:00
Alexis Laferrière
66586b5f63 [ModuleInterface] Print alias for module names in swiftinterface files
Ambiguities are introduced in generated swiftinterfaces when a type
shares a name with a module (i.e. XCTest). This workaround uses the
module-alias feature to avoid these ambiguities. Writing module
references with a distinguishable prefix should allow normal
type-checking to avoid the usual ambiguities.

We should still aim for a proper fully-qualified named syntax, but this
may help in the mean time.

rdar://101969500
2022-11-04 12:30:33 -07:00
Zoe Carver
ae7466f699 Merge pull request #61895 from zoecarver/add-flag-for-c-frt
Put C foreign refernece types behind a flag.
2022-11-03 13:54:01 -07:00
zoecarver
bf652b6f31 Put C foreign refernece types behind a flag. 2022-11-02 17:08:31 -07:00
Stephen Canon
33d178cf60 Merge pull request #59623 from rxwei/cherry-42611 (#61793)
* Merge pull request #59623 from rxwei/cherry-42611

* Fixup switch.swift test from bad merge.

Co-authored-by: Richard Wei <rxrwei@gmail.com>
2022-11-02 14:02:16 -04:00
Pavel Yaskevich
bf6d893abe Merge pull request #61844 from xedin/rdar-99884335
[Basic] Make it possible to access some experimental features in production compilers
2022-11-01 14:28:39 -07:00
Pavel Yaskevich
f779f8059f [Basic] Make it possible to access some experimental features in production compilers
Resolves: rdar://99884335
2022-11-01 10:15:51 -07:00
Alexis Laferrière
47b29b68db Merge pull request #61649 from xymus/index-swiftinterfaces
[Index] Force indexing of system modules to read only from swiftinterfaces
2022-10-31 14:18:45 -07:00