Skip to content

Commit 07c7f59

Browse files
committed
Merge branch 'main' of github.com:apple/swift into maxd/main-merge
# Conflicts: # stdlib/private/StdlibUnittest/RaceTest.swift # stdlib/private/SwiftPrivateThreadExtras/SwiftPrivateThreadExtras.swift # stdlib/private/SwiftPrivateThreadExtras/ThreadBarriers.swift # stdlib/public/Concurrency/ThreadSanitizer.cpp # test/stdlib/Character.swift # test/stdlib/Error.swift # test/stdlib/FloatingPoint.swift.gyb # test/stdlib/KeyPath.swift # test/stdlib/Mirror.swift # test/stdlib/NumericParsing.swift.gyb # test/stdlib/Optional.swift # test/stdlib/Repeat.swift # test/stdlib/StaticString.swift # test/stdlib/UnsafePointer.swift.gyb # test/stdlib/UnsafeRawBufferPointer.swift # test/stdlib/UnsafeRawPointer.swift
2 parents 6c41d09 + c78674f commit 07c7f59

File tree

110 files changed

+2759
-654
lines changed

Some content is hidden

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

110 files changed

+2759
-654
lines changed

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function(_report_sdk prefix)
6363
if(NOT prefix IN_LIST SWIFT_DARWIN_PLATFORMS)
6464
foreach(arch ${SWIFT_SDK_${prefix}_ARCHITECTURES})
6565
message(STATUS " ${arch} libc header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}")
66-
message(STATUS " ${arch} libc architecture specific header path: ${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY}")
6766
endforeach()
6867
endif()
6968

@@ -288,7 +287,6 @@ macro(configure_sdk_unix name architectures)
288287
swift_android_sysroot(android_sysroot)
289288
set(SWIFT_SDK_ANDROID_ARCH_${arch}_PATH "${android_sysroot}")
290289
set(SWIFT_SDK_ANDROID_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY "${android_sysroot}/usr/include" CACHE STRING "Path to C library headers")
291-
set(SWIFT_SDK_ANDROID_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY "${android_sysroot}/usr/include" CACHE STRING "Path to C library architecture headers")
292290

293291
if("${arch}" STREQUAL "armv7")
294292
set(SWIFT_SDK_ANDROID_ARCH_${arch}_NDK_TRIPLE "arm-linux-androideabi")
@@ -320,10 +318,8 @@ macro(configure_sdk_unix name architectures)
320318

321319
if("${prefix}" STREQUAL "HAIKU")
322320
set(SWIFT_SDK_HAIKU_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY "/system/develop/headers/posix" CACHE STRING "Path to C library headers")
323-
set(SWIFT_SDK_HAIKU_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY "/system/develop/headers" CACHE STRING "Path to C library architecture headers")
324321
else()
325322
set(SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY "/usr/include" CACHE STRING "Path to C library headers")
326-
set(SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY "${SWIFT_SDK_${prefix}_ARCH_${arch}_LIBC_INCLUDE_DIRECTORY}/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE STRING "Path to C library architecture headers")
327323
endif()
328324

329325
if("${prefix}" STREQUAL "LINUX")
@@ -373,7 +369,6 @@ macro(configure_sdk_unix name architectures)
373369
set(SWIFT_SDK_WASI_ARCH_wasm32_PATH "${SWIFT_WASI_SYSROOT_PATH}")
374370
set(SWIFT_SDK_WASI_ARCH_wasm32_TRIPLE "wasm32-unknown-wasi")
375371
set(SWIFT_SDK_WASI_ARCH_wasm32_LIBC_INCLUDE_DIRECTORY "${SWIFT_WASI_SYSROOT_PATH}/include")
376-
set(SWIFT_SDK_WASI_ARCH_wasm32_LIBC_ARCHITECTURE_INCLUDE_DIRECTORY "${SWIFT_WASI_SYSROOT_PATH}/include")
377372
else()
378373
message(FATAL_ERROR "unknown Unix OS: ${prefix}")
379374
endif()

include/swift/ABI/Executor.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ class ExecutorRef {
124124
/// Is this executor the main executor?
125125
bool isMainExecutor() const;
126126

127+
/// Get the raw value of the Implementation field, for tracing.
128+
uintptr_t getRawImplementation() { return Implementation; }
129+
127130
bool operator==(ExecutorRef other) const {
128131
return Identity == other.Identity;
129132
}

include/swift/ABI/Task.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,14 @@ class AsyncTask : public Job {
272272

273273
/// Set the task's ID field to the next task ID.
274274
void setTaskId();
275+
uint64_t getTaskId();
276+
277+
/// Get the task's resume function, for logging purposes only. This will
278+
/// attempt to see through the various adapters that are sometimes used, and
279+
/// failing that will return ResumeTask. The returned function pointer may
280+
/// have a different signature than ResumeTask, and it's only for identifying
281+
/// code associated with the task.
282+
const void *getResumeFunctionForLogging();
275283

276284
/// Given that we've already fully established the job context
277285
/// in the current thread, start running this task. To establish

include/swift/ABI/TaskStatus.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace swift {
3535
/// access by a cancelling thread. In particular, the chain of
3636
/// status records must not be disturbed. When the task leaves
3737
/// the scope that requires the status record, the record can
38-
/// be unregistered from the task with `swift_task_removeStatusRecord`,
38+
/// be unregistered from the task with `removeStatusRecord`,
3939
/// at which point the memory can be returned to the system.
4040
class TaskStatusRecord {
4141
public:
@@ -256,7 +256,7 @@ class TaskGroupTaskStatusRecord : public TaskStatusRecord {
256256
///
257257
/// The end of any call to the function will be ordered before the
258258
/// end of a call to unregister this record from the task. That is,
259-
/// code may call `swift_task_removeStatusRecord` and freely
259+
/// code may call `removeStatusRecord` and freely
260260
/// assume after it returns that this function will not be
261261
/// subsequently used.
262262
class CancellationNotificationStatusRecord : public TaskStatusRecord {
@@ -284,7 +284,7 @@ class CancellationNotificationStatusRecord : public TaskStatusRecord {
284284
///
285285
/// The end of any call to the function will be ordered before the
286286
/// end of a call to unregister this record from the task. That is,
287-
/// code may call `swift_task_removeStatusRecord` and freely
287+
/// code may call `removeStatusRecord` and freely
288288
/// assume after it returns that this function will not be
289289
/// subsequently used.
290290
class EscalationNotificationStatusRecord : public TaskStatusRecord {

include/swift/AST/DiagnosticsParse.def

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,11 @@ ERROR(enum_case_dot_prefix,none,
251251
ERROR(static_var_decl_global_scope,none,
252252
"%select{%error|static properties|class properties}0 may only be declared on a type",
253253
(StaticSpellingKind))
254-
ERROR(computed_property_no_accessors, none,
255-
"%select{computed property|subscript}0 must have accessors specified", (bool))
254+
ERROR(unexpected_curly_braces_in_decl, none,
255+
"unexpected '{' in declaration", ())
256+
ERROR(missing_accessor_return_decl,none,
257+
"missing return in %select{accessor|subscript}0 expected to return %1",
258+
(bool, TypeRepr*))
256259
ERROR(expected_getset_in_protocol,none,
257260
"expected get or set in a protocol property", ())
258261
ERROR(unexpected_getset_implementation_in_protocol,none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ WARNING(conditional_downcast_same_type,none,
11081108
"bridging conversion; did you mean to use 'as'?}2",
11091109
(Type, Type, unsigned))
11101110
WARNING(is_expr_same_type,none,
1111-
"checking a value with optional type %0 against dynamic type %1 "
1111+
"checking a value with optional type %0 against type %1 "
11121112
"succeeds whenever the value is non-nil; did you mean to use "
11131113
"'!= nil'?", (Type, Type))
11141114
WARNING(downcast_to_unrelated,none,

include/swift/AST/PrintOptions.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ struct PrintOptions {
128128
/// Whether to print function definitions.
129129
bool FunctionDefinitions = false;
130130

131+
/// Whether to print expressions.
132+
bool PrintExprs = false;
133+
131134
/// Whether to print '{ get set }' on readwrite computed properties.
132135
bool PrintGetSetOnRWProperties = true;
133136

@@ -644,6 +647,13 @@ struct PrintOptions {
644647
///
645648
/// This is only intended for debug output.
646649
static PrintOptions printEverything() {
650+
PrintOptions result = printDeclarations();
651+
result.FunctionDefinitions = true;
652+
result.PrintExprs = true;
653+
return result;
654+
}
655+
656+
static PrintOptions printDeclarations() {
647657
PrintOptions result = printVerbose();
648658
result.ExcludeAttrList.clear();
649659
result.ExcludeAttrList.push_back(DAK_FixedLayout);

include/swift/Frontend/FrontendOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class FrontendOptions {
118118
EmitSyntax, ///< Parse and dump Syntax tree as JSON
119119
DumpAST, ///< Parse, type-check, and dump AST
120120
PrintAST, ///< Parse, type-check, and pretty-print AST
121+
PrintASTDecl, ///< Parse, type-check, and pretty-print AST declarations
121122

122123
/// Parse and dump scope map.
123124
DumpScopeMaps,

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,10 @@ def print_ast : Flag<["-"], "print-ast">,
10511051
HelpText<"Parse and type-check input file(s) and pretty print AST(s)">,
10521052
ModeOpt,
10531053
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
1054+
def print_ast_decl : Flag<["-"], "print-ast-decl">,
1055+
HelpText<"Parse and type-check input file(s) and pretty print declarations from AST(s)">,
1056+
ModeOpt,
1057+
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>;
10541058
def dump_pcm : Flag<["-"], "dump-pcm">,
10551059
HelpText<"Dump debugging information about a precompiled Clang module">,
10561060
ModeOpt,

include/swift/Parse/Parser.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,10 +1169,9 @@ class Parser {
11691169
struct ParsedAccessors;
11701170
ParserStatus parseGetSet(ParseDeclOptions Flags,
11711171
GenericParamList *GenericParams,
1172-
ParameterList *Indices,
1172+
ParameterList *Indices, TypeRepr *ResultType,
11731173
ParsedAccessors &accessors,
1174-
AbstractStorageDecl *storage,
1175-
SourceLoc StaticLoc);
1174+
AbstractStorageDecl *storage, SourceLoc StaticLoc);
11761175
ParserResult<VarDecl> parseDeclVarGetSet(PatternBindingEntry &entry,
11771176
ParseDeclOptions Flags,
11781177
SourceLoc StaticLoc,

include/swift/Runtime/Concurrency.h

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#ifndef SWIFT_RUNTIME_CONCURRENCY_H
1818
#define SWIFT_RUNTIME_CONCURRENCY_H
1919

20+
#include "swift/ABI/AsyncLet.h"
2021
#include "swift/ABI/Task.h"
2122
#include "swift/ABI/TaskGroup.h"
22-
#include "swift/ABI/AsyncLet.h"
2323
#include "swift/ABI/TaskStatus.h"
2424

2525
#pragma clang diagnostic push
@@ -466,40 +466,6 @@ void swift_asyncLet_consume_throwing(SWIFT_ASYNC_CONTEXT AsyncContext *,
466466
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
467467
bool swift_taskGroup_hasTaskGroupRecord();
468468

469-
/// Add a status record to a task. The record should not be
470-
/// modified while it is registered with a task.
471-
///
472-
/// This must be called synchronously with the task.
473-
///
474-
/// If the task is already cancelled, returns `false` but still adds
475-
/// the status record.
476-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
477-
bool swift_task_addStatusRecord(TaskStatusRecord *record);
478-
479-
/// Add a status record to a task if the task has not already
480-
/// been cancelled. The record should not be modified while it is
481-
/// registered with a task.
482-
///
483-
/// This must be called synchronously with the task.
484-
///
485-
/// If the task is already cancelled, returns `false` and does not
486-
/// add the status record.
487-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
488-
bool swift_task_tryAddStatusRecord(TaskStatusRecord *record);
489-
490-
/// Remove a status record from a task. After this call returns,
491-
/// the record's memory can be freely modified or deallocated.
492-
///
493-
/// This must be called synchronously with the task. The record must
494-
/// be registered with the task or else this may crash.
495-
///
496-
/// The given record need not be the last record added to
497-
/// the task, but the operation may be less efficient if not.
498-
///
499-
/// Returns false if the task has been cancelled.
500-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
501-
bool swift_task_removeStatusRecord(TaskStatusRecord *record);
502-
503469
/// Signifies whether the current task is in the middle of executing the
504470
/// operation block of a `with(Throwing)TaskGroup(...) { <operation> }`.
505471
///
@@ -509,18 +475,6 @@ bool swift_task_removeStatusRecord(TaskStatusRecord *record);
509475
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
510476
bool swift_task_hasTaskGroupStatusRecord();
511477

512-
/// Attach a child task to its parent task and return the newly created
513-
/// `ChildTaskStatusRecord`.
514-
///
515-
/// The record must be removed with by the parent invoking
516-
/// `swift_task_detachChild` when the child has completed.
517-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
518-
ChildTaskStatusRecord* swift_task_attachChild(AsyncTask *child);
519-
520-
/// Remove a child task from the parent tracking it.
521-
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
522-
void swift_task_detachChild(ChildTaskStatusRecord *record);
523-
524478
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
525479
size_t swift_task_getJobFlags(AsyncTask* task);
526480

lib/APIDigester/ModuleAnalyzerNodes.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,10 +1906,11 @@ void SwiftDeclCollector::lookupVisibleDecls(ArrayRef<ModuleDecl *> Modules) {
19061906
for (auto *D: KnownDecls) {
19071907
if (auto *Ext = dyn_cast<ExtensionDecl>(D)) {
19081908
if (HandledExtensions.find(Ext) == HandledExtensions.end()) {
1909-
auto *NTD = Ext->getExtendedNominal();
1910-
// Check if the extension is from other modules.
1911-
if (!llvm::is_contained(Modules, NTD->getModuleContext())) {
1912-
ExtensionMap[NTD].push_back(Ext);
1909+
if (auto *NTD = Ext->getExtendedNominal()) {
1910+
// Check if the extension is from other modules.
1911+
if (!llvm::is_contained(Modules, NTD->getModuleContext())) {
1912+
ExtensionMap[NTD].push_back(Ext);
1913+
}
19131914
}
19141915
}
19151916
}

lib/AST/ASTContext.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ struct ASTContext::Implementation {
389389
llvm::FoldingSet<TypeAliasType> TypeAliasTypes;
390390
llvm::FoldingSet<TupleType> TupleTypes;
391391
llvm::FoldingSet<PackType> PackTypes;
392+
llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
392393
llvm::DenseMap<llvm::PointerIntPair<TypeBase*, 3, unsigned>,
393394
MetatypeType*> MetatypeTypes;
394395
llvm::DenseMap<llvm::PointerIntPair<TypeBase*, 3, unsigned>,
@@ -471,7 +472,6 @@ struct ASTContext::Implementation {
471472
llvm::FoldingSet<SILBoxType> SILBoxTypes;
472473
llvm::DenseMap<BuiltinIntegerWidth, BuiltinIntegerType*> IntegerTypes;
473474
llvm::FoldingSet<BuiltinVectorType> BuiltinVectorTypes;
474-
llvm::FoldingSet<PackExpansionType> PackExpansionTypes;
475475
llvm::FoldingSet<DeclName::CompoundDeclName> CompoundNames;
476476
llvm::DenseMap<UUID, OpenedArchetypeType *> OpenedExistentialArchetypes;
477477
llvm::FoldingSet<IndexSubset> IndexSubsets;
@@ -2960,20 +2960,25 @@ Type TupleTypeElt::getType() const {
29602960
PackExpansionType *PackExpansionType::get(Type patternTy) {
29612961
assert(patternTy && "Missing pattern type in expansion");
29622962

2963+
auto properties = patternTy->getRecursiveProperties();
2964+
auto arena = getArena(properties);
2965+
29632966
auto &context = patternTy->getASTContext();
29642967
llvm::FoldingSetNodeID id;
29652968
PackExpansionType::Profile(id, patternTy);
29662969

29672970
void *insertPos;
29682971
if (PackExpansionType *expType =
2969-
context.getImpl().PackExpansionTypes.FindNodeOrInsertPos(id,
2970-
insertPos))
2972+
context.getImpl()
2973+
.getArena(arena)
2974+
.PackExpansionTypes.FindNodeOrInsertPos(id, insertPos))
29712975
return expType;
29722976

29732977
const ASTContext *canCtx = patternTy->isCanonical() ? &context : nullptr;
29742978
PackExpansionType *expansionTy = new (context, AllocationArena::Permanent)
29752979
PackExpansionType(patternTy, canCtx);
2976-
context.getImpl().PackExpansionTypes.InsertNode(expansionTy, insertPos);
2980+
context.getImpl().getArena(arena).PackExpansionTypes.InsertNode(expansionTy,
2981+
insertPos);
29772982
return expansionTy;
29782983
}
29792984

0 commit comments

Comments
 (0)