Skip to content

Commit 1af59ef

Browse files
authored
Merge pull request #3931 from swiftwasm/maxd/main-merge
Resolve conflicts with upstream `main`
2 parents bc0604a + fabfcd8 commit 1af59ef

File tree

76 files changed

+2330
-948
lines changed

Some content is hidden

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

76 files changed

+2330
-948
lines changed

benchmark/cmake/modules/AddSwiftBenchmarkSuite.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,10 @@ function(swift_benchmark_compile)
708708
cmake_parse_arguments(SWIFT_BENCHMARK_COMPILE "" "PLATFORM" "" ${ARGN})
709709

710710
if(NOT SWIFT_BENCHMARK_BUILT_STANDALONE)
711-
set(stdlib_dependencies "swift-frontend")
711+
set(stdlib_dependencies "swift-frontend" "swiftCore-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
712+
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
713+
list(APPEND stdlib_dependencies "swiftDarwin-${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
714+
endif()
712715
foreach(stdlib_dependency ${UNIVERSAL_LIBRARY_NAMES_${SWIFT_BENCHMARK_COMPILE_PLATFORM}})
713716
string(FIND "${stdlib_dependency}" "Unittest" find_output)
714717
if("${find_output}" STREQUAL "-1")

cmake/modules/AddSwift.cmake

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -802,16 +802,6 @@ macro(add_swift_lib_subdirectory name)
802802
add_llvm_subdirectory(SWIFT LIB ${name})
803803
endmacro()
804804
805-
function(_link_built_compatibility_libs executable)
806-
set(platform ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR})
807-
target_link_directories(${executable} PRIVATE
808-
${SWIFTLIB_DIR}/${platform})
809-
add_dependencies(${executable}
810-
"swiftCompatibility50-${platform}"
811-
"swiftCompatibility51-${platform}"
812-
"swiftCompatibilityDynamicReplacements-${platform}")
813-
endfunction()
814-
815805
function(add_swift_host_tool executable)
816806
set(options HAS_LIBSWIFT)
817807
set(single_parameter_options SWIFT_COMPONENT BOOTSTRAPPING)
@@ -910,24 +900,26 @@ function(add_swift_host_tool executable)
910900
list(APPEND RPATH_LIST "/usr/lib/swift")
911901
912902
elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING-WITH-HOSTLIBS")
913-
# Pick up the built libswiftCompatibility<n>.a libraries
914-
_link_built_compatibility_libs(${executable})
915-
916903
# Add the SDK directory for the host platform.
917904
target_link_directories(${executable} PRIVATE "${sdk_dir}")
918905
906+
# A backup in case the toolchain doesn't have one of the compatibility libraries.
907+
target_link_directories(${executable} PRIVATE
908+
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
909+
919910
# Include the abi stable system stdlib in our rpath.
920911
list(APPEND RPATH_LIST "/usr/lib/swift")
921912
922913
elseif(LIBSWIFT_BUILD_MODE STREQUAL "BOOTSTRAPPING")
923-
# Pick up the built libswiftCompatibility<n>.a libraries
924-
_link_built_compatibility_libs(${executable})
925-
926914
# At build time link against the built swift libraries from the
927915
# previous bootstrapping stage.
928916
get_bootstrapping_swift_lib_dir(bs_lib_dir "${ASHT_BOOTSTRAPPING}")
929917
target_link_directories(${executable} PRIVATE ${bs_lib_dir})
930918
919+
# Required to pick up the built libswiftCompatibility<n>.a libraries
920+
target_link_directories(${executable} PRIVATE
921+
"${SWIFTLIB_DIR}/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
922+
931923
# At runtime link against the built swift libraries from the current
932924
# bootstrapping stage.
933925
list(APPEND RPATH_LIST "@executable_path/../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")

cmake/modules/StandaloneOverlay.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ set(SWIFT_DARWIN_MODULE_ARCHS "" CACHE STRING
8585
targets on Darwin platforms. These targets are in addition to the full \
8686
library targets.")
8787

88+
option(SWIFT_STDLIB_SHORT_MANGLING_LOOKUPS
89+
"Build stdlib with fast-path context descriptor lookups based on well-known short manglings."
90+
TRUE)
8891

8992
# -----------------------------------------------------------------------------
9093
# Constants

include/swift/AST/Decl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ enum class AssociatedValueCheck {
207207
/// Diagnostic printing of \c StaticSpellingKind.
208208
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, StaticSpellingKind SSK);
209209

210+
/// Diagnostic printing of \c ReferenceOwnership.
211+
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, ReferenceOwnership RO);
212+
210213
/// Encapsulation of the overload signature of a given declaration,
211214
/// which is used to determine uniqueness of a declaration within a
212215
/// given context.

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -398,22 +398,12 @@ NOTE(generic_parameter_inferred_from_result_context,none,
398398
ERROR(cannot_pass_type_to_non_ephemeral,none,
399399
"cannot pass %0 to parameter; argument %1 must be a pointer that "
400400
"outlives the call%select{| to %3}2", (Type, StringRef, bool, DeclName))
401-
WARNING(cannot_pass_type_to_non_ephemeral_warning,none,
402-
"passing %0 to parameter, but argument %1 should be a pointer that "
403-
"outlives the call%select{| to %3}2", (Type, StringRef, bool, DeclName))
404401
ERROR(cannot_use_inout_non_ephemeral,none,
405402
"cannot use inout expression here; argument %0 must be a pointer that "
406403
"outlives the call%select{| to %2}1", (StringRef, bool, DeclName))
407-
WARNING(cannot_use_inout_non_ephemeral_warning,none,
408-
"inout expression creates a temporary pointer, but argument %0 should "
409-
"be a pointer that outlives the call%select{| to %2}1",
410-
(StringRef, bool, DeclName))
411404
ERROR(cannot_construct_dangling_pointer,none,
412405
"initialization of %0 results in a dangling %select{|buffer }1pointer",
413406
(Type, unsigned))
414-
WARNING(cannot_construct_dangling_pointer_warning,none,
415-
"initialization of %0 results in a dangling %select{|buffer }1pointer",
416-
(Type, unsigned))
417407
NOTE(ephemeral_pointer_argument_conversion_note,none,
418408
"implicit argument conversion from %0 to %1 produces a pointer valid only "
419409
"for the duration of the call%select{| to %3}2",
@@ -1881,9 +1871,6 @@ WARNING(spi_attribute_on_import_of_public_module,none,
18811871
(DeclName, StringRef))
18821872

18831873
// Opaque return types
1884-
ERROR(structural_opaque_types_are_experimental,none,
1885-
"'opaque' types cannot be nested inside other types; "
1886-
"structural 'opaque' types are an experimental feature", ())
18871874
ERROR(opaque_type_invalid_constraint,none,
18881875
"an 'opaque' type must specify only 'Any', 'AnyObject', protocols, "
18891876
"and/or a base class", ())
@@ -4878,6 +4865,10 @@ ERROR(opaque_type_unsupported_pattern,none,
48784865
ERROR(opaque_type_in_protocol_requirement,none,
48794866
"'some' type cannot be the return type of a protocol requirement; did you mean to add an associated type?",
48804867
())
4868+
ERROR(opaque_type_in_parameter,none,
4869+
"'some' cannot appear in parameter position in result "
4870+
"type %0",
4871+
(Type))
48814872

48824873
// Function differentiability
48834874
ERROR(attr_only_on_parameters_of_differentiable,none,

include/swift/AST/EducationalNotes.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,9 @@ EDUCATIONAL_NOTES(could_not_use_member_on_existential,
2525
"existential-member-access-limitations.md")
2626

2727
EDUCATIONAL_NOTES(cannot_pass_type_to_non_ephemeral, "temporary-pointers.md")
28-
EDUCATIONAL_NOTES(cannot_pass_type_to_non_ephemeral_warning,
29-
"temporary-pointers.md")
3028
EDUCATIONAL_NOTES(cannot_use_inout_non_ephemeral,
3129
"temporary-pointers.md")
32-
EDUCATIONAL_NOTES(cannot_use_inout_non_ephemeral_warning,
33-
"temporary-pointers.md")
3430
EDUCATIONAL_NOTES(cannot_construct_dangling_pointer, "temporary-pointers.md")
35-
EDUCATIONAL_NOTES(cannot_construct_dangling_pointer_warning,
36-
"temporary-pointers.md")
37-
38-
3931

4032
EDUCATIONAL_NOTES(non_nominal_no_initializers, "nominal-types.md")
4133
EDUCATIONAL_NOTES(non_nominal_extension, "nominal-types.md")

include/swift/AST/LayoutConstraintKind.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//
1515
//===----------------------------------------------------------------------===//
1616

17-
#include "llvm/Support/DataTypes.h"
17+
#include <cstdint>
1818

1919
#ifndef SWIFT_LAYOUT_CONSTRAINTKIND_H
2020
#define SWIFT_LAYOUT_CONSTRAINTKIND_H

include/swift/AST/Ownership.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "llvm/ADT/StringRef.h"
2424
#include "llvm/Support/Compiler.h"
2525
#include "llvm/Support/ErrorHandling.h"
26-
#include "llvm/Support/raw_ostream.h"
2726
#include <assert.h>
2827
#include <limits.h>
2928
#include <stdint.h>
@@ -118,9 +117,6 @@ optionalityOf(ReferenceOwnership ownership) {
118117
llvm_unreachable("impossible");
119118
}
120119

121-
/// Diagnostic printing of \c StaticSpellingKind.
122-
llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, ReferenceOwnership RO);
123-
124120
/// Different kinds of value ownership supported by Swift.
125121
enum class ValueOwnership : uint8_t {
126122
/// the context-dependent default ownership (sometimes shared,

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,6 @@ namespace swift {
310310
/// `func f() -> <T> T`.
311311
bool EnableExperimentalNamedOpaqueTypes = false;
312312

313-
/// Enable experimental support for structural opaque result types, e.g.
314-
/// `func f() -> (some P)?`.
315-
bool EnableExperimentalStructuralOpaqueTypes = false;
316-
317313
/// Enable experimental flow-sensitive concurrent captures.
318314
bool EnableExperimentalFlowSensitiveConcurrentCaptures = false;
319315

include/swift/SIL/DebugUtils.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,34 @@ struct DebugVarCarryingInst {
327327
}
328328
};
329329

330+
/// Attempt to discover a StringRef varName for the value \p value. If we fail,
331+
/// we return the name "unknown".
332+
inline StringRef getDebugVarName(SILValue value) {
333+
if (auto *asi = dyn_cast<AllocStackInst>(value)) {
334+
DebugVarCarryingInst debugVar(asi);
335+
if (auto varInfo = debugVar.getVarInfo()) {
336+
return varInfo->Name;
337+
} else {
338+
if (auto *decl = debugVar.getDecl()) {
339+
return decl->getBaseName().userFacingName();
340+
}
341+
}
342+
}
343+
344+
StringRef varName = "unknown";
345+
if (auto *use = getSingleDebugUse(value)) {
346+
DebugVarCarryingInst debugVar(use->getUser());
347+
if (auto varInfo = debugVar.getVarInfo()) {
348+
varName = varInfo->Name;
349+
} else {
350+
if (auto *decl = debugVar.getDecl()) {
351+
varName = decl->getBaseName().userFacingName();
352+
}
353+
}
354+
}
355+
return varName;
356+
}
357+
330358
} // end namespace swift
331359

332360
#endif // SWIFT_SIL_DEBUGUTILS_H

0 commit comments

Comments
 (0)