Skip to content

Commit 11c046f

Browse files
Merge pull request #5411 from swiftwasm/main
[pull] swiftwasm from main
2 parents 325598f + 08c4646 commit 11c046f

File tree

172 files changed

+3072
-1249
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+3072
-1249
lines changed

docs/ABI/Mangling.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ are always non-polymorphic ``<impl-function-type>`` types.
301301
VALUE-WITNESS-KIND ::= 'ug' // getEnumTag
302302
VALUE-WITNESS-KIND ::= 'up' // destructiveProjectEnumData
303303
VALUE-WITNESS-KIND ::= 'ui' // destructiveInjectEnumTag
304+
VALUE-WITNESS-KIND ::= 'et' // getEnumTagSinglePayload
305+
VALUE-WITNESS-KIND ::= 'st' // storeEnumTagSinglePayload
304306

305307
``<VALUE-WITNESS-KIND>`` differentiates the kinds of value
306308
witness functions for a type.

docs/HowToGuides/GettingStarted.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,25 +463,34 @@ Now that you have made some changes, you will need to rebuild...
463463
464464
### Incremental builds with Ninja
465465
466-
To rebuild the compiler:
466+
Subsequent steps in this and the next subsections are specific to the platform you're building on, so we'll try to detect it first and reuse as a shell variable:
467+
467468
```sh
468-
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m) bin/swift-frontend
469+
platform=$([[ $(uname) == Darwin ]] && echo macosx || echo linux)
469470
```
470471
471-
To rebuild everything, including the standard library:
472+
After setting that variable you can rebuild the compiler incrementally with this command:
472473
```sh
473-
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)
474+
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m) bin/swift-frontend
474475
```
475476
477+
To rebuild everything that has its sources located in the `swift` repository, including the standard library:
478+
```sh
479+
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m)
480+
```
481+
482+
Similarly, you can rebuild other projects like Foundation or Dispatch by substituting their respective subdirectories in the commands above.
483+
476484
### Spot checking an incremental build
477485
478486
As a quick test, go to `lib/Basic/Version.cpp` and tweak the version
479487
printing code slightly. Next, do an incremental build as above. This incremental
480488
build should be much faster than the from-scratch build at the beginning.
481-
Now check if the version string has been updated:
489+
Now check if the version string has been updated (assumes you have `platform` shell variable
490+
defined as specified in the previous subsection:
482491
483492
```sh
484-
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/bin/swift-frontend --version
493+
../build/Ninja-RelWithDebInfoAssert/swift-$(platform)-$(uname -m)/bin/swift-frontend --version
485494
```
486495
487496
This should print your updated version string.

include/swift/AST/CASTBridging.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ void Plugin_setCapability(PluginHandle handle, PluginCapabilityPtr data);
313313
/// Get a capability data set by \c Plugin_setCapability .
314314
PluginCapabilityPtr _Nullable Plugin_getCapability(PluginHandle handle);
315315

316+
/// Get the executable file path of the plugin.
317+
const char *Plugin_getExecutableFilePath(PluginHandle handle);
318+
316319
/// Lock the plugin. Clients should lock it during sending and recving the
317320
/// response.
318321
void Plugin_lock(PluginHandle handle);

include/swift/AST/DiagnosticsSIL.def

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,18 @@ ERROR(noimplicitcopy_used_on_generic_or_existential, none,
735735
"@_noImplicitCopy can not be used on a generic or existential typed "
736736
"binding or a nominal type containing such typed things", ())
737737

738+
// forget statement
739+
ERROR(forget_nontrivial_storage,none,
740+
"can only 'forget' type %0 if it contains trivially-destroyed "
741+
"stored properties at this time",
742+
(Type))
743+
NOTE(forget_nontrivial_storage_note,none,
744+
"type %0 cannot be trivially destroyed",
745+
(Type))
746+
NOTE(forget_nontrivial_implicit_storage_note,none,
747+
"type %0 implicitly contains %1 which cannot be trivially destroyed",
748+
(Type, Type))
749+
738750
// move only checker diagnostics
739751
ERROR(sil_moveonlychecker_owned_value_consumed_more_than_once, none,
740752
"'%0' consumed more than once", (StringRef))

include/swift/AST/DiagnosticsSema.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,6 +1694,14 @@ ERROR(expose_enum_case_type_to_cxx,none,
16941694
"enum %0 can not be represented in C++ as one of its cases has an associated value with type that can't be represented in C++", (ValueDecl *))
16951695
ERROR(expose_enum_case_tuple_to_cxx,none,
16961696
"enum %0 can not yet be represented in C++ as one of its cases has multiple associated values", (ValueDecl *))
1697+
ERROR(expose_protocol_to_cxx_unsupported,none,
1698+
"protocol %0 can not yet be represented in C++", (ValueDecl *))
1699+
ERROR(expose_move_only_to_cxx,none,
1700+
"move-only %0 %1 can not yet be represented in C++", (DescriptiveDeclKind, ValueDecl *))
1701+
ERROR(unexposed_other_decl_in_cxx,none,
1702+
"%0 %1 is not yet exposed to C++", (DescriptiveDeclKind, ValueDecl *))
1703+
ERROR(unsupported_other_decl_in_cxx,none,
1704+
"Swift %0 %1 cannot be represented in C++", (DescriptiveDeclKind, ValueDecl *))
16971705

16981706
ERROR(attr_methods_only,none,
16991707
"only methods can be declared %0", (DeclAttribute))
@@ -4599,9 +4607,16 @@ ERROR(opaque_type_var_no_underlying_type,none,
45994607
"property declares an opaque return type, but cannot infer the "
46004608
"underlying type from its initializer expression", ())
46014609

4610+
4611+
//------------------------------------------------------------------------------
4612+
// MARK: Forget Statement
4613+
//------------------------------------------------------------------------------
46024614
ERROR(forget_wrong_context_decl,none,
46034615
"'forget' statement cannot appear in %0",
46044616
(DescriptiveDeclKind))
4617+
ERROR(forget_no_deinit,none,
4618+
"'forget' has no effect for type %0 unless it has a deinitializer",
4619+
(Type))
46054620
ERROR(forget_wrong_context_closure,none,
46064621
"'forget' statement cannot appear in closure",
46074622
())
@@ -7128,6 +7143,8 @@ ERROR(ownership_specifier_copyable,none,
71287143
ERROR(self_ownership_specifier_copyable,none,
71297144
"%0 is not yet valid on %1s in a Copyable type",
71307145
(SelfAccessKind, DescriptiveDeclKind))
7146+
ERROR(ownership_specifier_nonescaping_closure,none,
7147+
"'%0' cannot be applied to nonescaping closure", (StringRef))
71317148

71327149
//------------------------------------------------------------------------------
71337150
// MARK: Runtime discoverable attributes (@runtimeMetadata)

include/swift/AST/KnownDecls.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ FUNC_DECL(DiagnoseUnexpectedError, "_unexpectedError")
6868
FUNC_DECL(DiagnoseUnexpectedNilOptional, "_diagnoseUnexpectedNilOptional")
6969
FUNC_DECL(DiagnoseUnexpectedEnumCase, "_diagnoseUnexpectedEnumCase")
7070
FUNC_DECL(DiagnoseUnexpectedEnumCaseValue, "_diagnoseUnexpectedEnumCaseValue")
71+
FUNC_DECL(DiagnoseUnavailableCodeReached, "_diagnoseUnavailableCodeReached")
7172

7273
FUNC_DECL(GetErrorEmbeddedNSError, "_getErrorEmbeddedNSError")
7374

include/swift/AST/PluginRegistry.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef SWIFT_PLUGIN_REGISTRY_H
1313
#define SWIFT_PLUGIN_REGISTRY_H
1414

15+
#include "swift/Basic/StringExtras.h"
1516
#include "llvm/ADT/ArrayRef.h"
1617
#include "llvm/ADT/StringMap.h"
1718
#include "llvm/ADT/StringRef.h"
@@ -139,6 +140,10 @@ class LoadedExecutablePlugin {
139140

140141
llvm::sys::procid_t getPid() { return Process->pid; }
141142

143+
NullTerminatedStringRef getExecutablePath() {
144+
return {ExecutablePath.c_str(), ExecutablePath.size()};
145+
}
146+
142147
const void *getCapability() { return capability; };
143148
void setCapability(const void *newValue) { capability = newValue; };
144149

include/swift/AST/SwiftNameTranslation.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
#ifndef SWIFT_NAME_TRANSLATION_H
1414
#define SWIFT_NAME_TRANSLATION_H
1515

16-
#include "swift/AST/Identifier.h"
1716
#include "swift/AST/AttrKind.h"
17+
#include "swift/AST/DiagnosticEngine.h"
18+
#include "swift/AST/Identifier.h"
1819

1920
namespace swift {
2021
class ValueDecl;
@@ -76,8 +77,13 @@ enum RepresentationError {
7677
UnrepresentableIndirectEnum,
7778
UnrepresentableEnumCaseType,
7879
UnrepresentableEnumCaseTuple,
80+
UnrepresentableProtocol,
81+
UnrepresentableMoveOnly,
7982
};
8083

84+
/// Constructs a diagnostic that describes the given C++ representation error.
85+
Diagnostic diagnoseRepresenationError(RepresentationError error, ValueDecl *vd);
86+
8187
struct DeclRepresentation {
8288
RepresentationKind kind;
8389
llvm::Optional<RepresentationError> error;

include/swift/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ namespace swift {
112112
/// resulting binary by default in this mode.
113113
None,
114114

115+
/// Stub out code associated with unavailable declarations.
116+
///
117+
/// For example, the bodies of unavailable functions should be compiled as
118+
/// if they just contained a call to fatalError().
119+
Stub,
120+
115121
/// Avoid generating any code for unavailable declarations.
116122
///
117123
/// NOTE: This optimization can be ABI breaking for a library evolution

include/swift/IDE/CompletionLookup.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
324324

325325
bool isUnresolvedMemberIdealType(Type Ty);
326326

327+
/// Creates a \c CodeCompletionResultBuilder in this lookup’s sink and sets
328+
/// the current expected type context in it
329+
CodeCompletionResultBuilder
330+
makeResultBuilder(CodeCompletionResultKind kind,
331+
SemanticContextKind semanticContext) const;
332+
327333
void addValueBaseName(CodeCompletionResultBuilder &Builder,
328334
DeclBaseName Name);
329335

0 commit comments

Comments
 (0)