Skip to content

Commit 479ed5f

Browse files
authored
Merge pull request #3431 from swiftwasm/release/5.5
[pull] swiftwasm-release/5.5 from release/5.5
2 parents b0b7bcd + 9a93c18 commit 479ed5f

File tree

244 files changed

+11673
-7070
lines changed

Some content is hidden

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

244 files changed

+11673
-7070
lines changed

include/swift-c/DependencyScan/DependencyScan.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,30 @@ swiftscan_batch_scan_result_create(swiftscan_scanner_t scanner,
337337
SWIFTSCAN_PUBLIC swiftscan_import_set_t swiftscan_import_set_create(
338338
swiftscan_scanner_t scanner, swiftscan_scan_invocation_t invocation);
339339

340+
//=== Scanner Cache Operations --------------------------------------------===//
341+
// The following operations expose an implementation detail of the dependency
342+
// scanner: its module dependencies cache. This is done in order
343+
// to allow clients to perform incremental dependency scans by having the
344+
// scanner's state be serializable and re-usable.
345+
346+
/// For the specified \c scanner instance, serialize its state to the specified file-system \c path .
347+
SWIFTSCAN_PUBLIC void
348+
swiftscan_scanner_cache_serialize(swiftscan_scanner_t scanner,
349+
const char * path);
350+
351+
/// For the specified \c scanner instance, load in scanner state from a file at
352+
/// the specified file-system \c path .
353+
SWIFTSCAN_PUBLIC bool
354+
swiftscan_scanner_cache_load(swiftscan_scanner_t scanner,
355+
const char * path);
356+
357+
/// For the specified \c scanner instance, reset its internal state, ensuring subsequent
358+
/// scanning queries are done "from-scratch".
359+
SWIFTSCAN_PUBLIC void
360+
swiftscan_scanner_cache_reset(swiftscan_scanner_t scanner);
361+
362+
//===----------------------------------------------------------------------===//
363+
340364
SWIFTSCAN_END_DECLS
341365

342366
#endif // SWIFT_C_DEPENDENCY_SCAN_H

include/swift/APIDigester/ModuleAnalyzerNodes.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "clang/Sema/Lookup.h"
2424
#include "clang/Sema/Sema.h"
2525
#include "llvm/ADT/TinyPtrVector.h"
26+
#include "llvm/ADT/STLExtras.h"
2627
#include "llvm/Support/CommandLine.h"
2728
#include "llvm/Support/Compiler.h"
2829
#include "llvm/Support/FileSystem.h"
@@ -717,6 +718,12 @@ class SDKNodeDeclAccessor: public SDKNodeDeclAbstractFunc {
717718
void jsonize(json::Output &Out) override;
718719
};
719720

721+
class SDKNodeDeclImport: public SDKNodeDecl {
722+
public:
723+
SDKNodeDeclImport(SDKNodeInitInfo Info);
724+
static bool classof(const SDKNode *N);
725+
};
726+
720727
// The additional information we need for a type node in the digest.
721728
// We use type node to represent entities more than types, e.g. parameters, so
722729
// this struct is necessary to pass down to create a type node.
@@ -781,6 +788,8 @@ class SwiftDeclCollector: public VisibleDeclConsumer {
781788
void lookupVisibleDecls(ArrayRef<ModuleDecl *> Modules);
782789
};
783790

791+
void detectRename(SDKNode *L, SDKNode *R);
792+
784793
int dumpSwiftModules(const CompilerInvocation &InitInvok,
785794
const llvm::StringSet<> &ModuleNames,
786795
StringRef OutputDir,
@@ -799,6 +808,8 @@ int dumpSDKContent(const CompilerInvocation &InitInvok,
799808
const llvm::StringSet<> &ModuleNames,
800809
StringRef OutputFile, CheckerOptions Opts);
801810

811+
void dumpModuleContent(ModuleDecl *MD, StringRef OutputFile, bool ABI);
812+
802813
/// Mostly for testing purposes, this function de-serializes the SDK dump in
803814
/// dumpPath and re-serialize them to OutputPath. If the tool performs correctly,
804815
/// the contents in dumpPath and OutputPath should be identical.

include/swift/AST/ASTContext.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "llvm/ADT/PointerIntPair.h"
3838
#include "llvm/ADT/SetVector.h"
3939
#include "llvm/ADT/SmallPtrSet.h"
40+
#include "llvm/ADT/StringSet.h"
4041
#include "llvm/ADT/StringMap.h"
4142
#include "llvm/ADT/TinyPtrVector.h"
4243
#include "llvm/Support/Allocator.h"
@@ -825,6 +826,13 @@ class ASTContext final {
825826
ModuleDependenciesCache &cache,
826827
InterfaceSubContextDelegate &delegate);
827828

829+
/// Compute the extra implicit framework search paths on Apple platforms:
830+
/// $SDKROOT/System/Library/Frameworks/ and $SDKROOT/Library/Frameworks/.
831+
std::vector<std::string> getDarwinImplicitFrameworkSearchPaths() const;
832+
833+
/// Return a set of all possible filesystem locations where modules can be found.
834+
llvm::StringSet<> getAllModuleSearchPathsSet() const;
835+
828836
/// Load extensions to the given nominal type from the external
829837
/// module loaders.
830838
///

include/swift/AST/Attr.def

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -625,11 +625,7 @@ SIMPLE_DECL_ATTR(reasync, AtReasync,
625625
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
626626
110)
627627

628-
DECL_ATTR(completionHandlerAsync, CompletionHandlerAsync,
629-
OnAbstractFunction | ConcurrencyOnly | LongAttribute |
630-
ABIStableToAdd | ABIStableToRemove |
631-
APIStableToAdd | APIStableToRemove,
632-
111)
628+
// 111 was an experimental @completionHandlerAsync and is now unused
633629

634630
CONTEXTUAL_SIMPLE_DECL_ATTR(nonisolated, Nonisolated,
635631
DeclModifier | OnFunc | OnConstructor | OnVar | OnSubscript |

include/swift/AST/Attr.h

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ class AvailableAttr : public DeclAttribute {
626626

627627
AvailableAttr(SourceLoc AtLoc, SourceRange Range,
628628
PlatformKind Platform,
629-
StringRef Message, StringRef Rename,
629+
StringRef Message, StringRef Rename, ValueDecl *RenameDecl,
630630
const llvm::VersionTuple &Introduced,
631631
SourceRange IntroducedRange,
632632
const llvm::VersionTuple &Deprecated,
@@ -636,7 +636,7 @@ class AvailableAttr : public DeclAttribute {
636636
PlatformAgnosticAvailabilityKind PlatformAgnostic,
637637
bool Implicit)
638638
: DeclAttribute(DAK_Available, AtLoc, Range, Implicit),
639-
Message(Message), Rename(Rename),
639+
Message(Message), Rename(Rename), RenameDecl(RenameDecl),
640640
INIT_VER_TUPLE(Introduced), IntroducedRange(IntroducedRange),
641641
INIT_VER_TUPLE(Deprecated), DeprecatedRange(DeprecatedRange),
642642
INIT_VER_TUPLE(Obsoleted), ObsoletedRange(ObsoletedRange),
@@ -657,6 +657,12 @@ class AvailableAttr : public DeclAttribute {
657657
/// the `NS_SWIFT_NAME` annotation in Objective-C.
658658
const StringRef Rename;
659659

660+
/// The declaration referred to by \c Rename. Note that this is only set for
661+
/// deserialized attributes or inferred attributes from ObjectiveC code.
662+
/// \c ValueDecl::getRenamedDecl should be used to find the declaration
663+
/// corresponding to \c Rename.
664+
ValueDecl *RenameDecl;
665+
660666
/// Indicates when the symbol was introduced.
661667
const Optional<llvm::VersionTuple> Introduced;
662668

@@ -743,6 +749,11 @@ class AvailableAttr : public DeclAttribute {
743749
llvm::VersionTuple Obsoleted
744750
= llvm::VersionTuple());
745751

752+
/// Create an AvailableAttr that indicates the given \p AsyncFunc should be
753+
/// preferentially used in async contexts
754+
static AvailableAttr *createForAlternative(ASTContext &C,
755+
AbstractFunctionDecl *AsyncFunc);
756+
746757
AvailableAttr *clone(ASTContext &C, bool implicit) const;
747758

748759
static bool classof(const DeclAttribute *DA) {
@@ -2041,57 +2052,6 @@ class TransposeAttr final
20412052
}
20422053
};
20432054

2044-
/// The `@completionHandlerAsync` attribute marks a function as having an async
2045-
/// alternative, optionally providing a name (for cases when the alternative
2046-
/// has a different name).
2047-
class CompletionHandlerAsyncAttr final : public DeclAttribute {
2048-
public:
2049-
/// Reference to the async alternative function. Only set for deserialized
2050-
/// attributes or inferred attributes from ObjectiveC code.
2051-
AbstractFunctionDecl *AsyncFunctionDecl;
2052-
2053-
/// DeclName of the async function in the attribute. Only set from actual
2054-
/// Swift code, deserialization/ObjectiveC imports will set the decl instead.
2055-
const DeclNameRef AsyncFunctionName;
2056-
2057-
/// Source location of the async function name in the attribute
2058-
const SourceLoc AsyncFunctionNameLoc;
2059-
2060-
/// The index of the completion handler
2061-
const size_t CompletionHandlerIndex;
2062-
2063-
/// Source location of the completion handler index passed to the index
2064-
const SourceLoc CompletionHandlerIndexLoc;
2065-
2066-
CompletionHandlerAsyncAttr(DeclNameRef asyncFunctionName,
2067-
SourceLoc asyncFunctionNameLoc,
2068-
size_t completionHandlerIndex,
2069-
SourceLoc completionHandlerIndexLoc,
2070-
SourceLoc atLoc, SourceRange range)
2071-
: DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2072-
/*implicit*/ false),
2073-
AsyncFunctionDecl(nullptr),
2074-
AsyncFunctionName(asyncFunctionName),
2075-
AsyncFunctionNameLoc(asyncFunctionNameLoc),
2076-
CompletionHandlerIndex(completionHandlerIndex),
2077-
CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2078-
2079-
CompletionHandlerAsyncAttr(AbstractFunctionDecl &asyncFunctionDecl,
2080-
size_t completionHandlerIndex,
2081-
SourceLoc completionHandlerIndexLoc,
2082-
SourceLoc atLoc, SourceRange range,
2083-
bool implicit)
2084-
: DeclAttribute(DAK_CompletionHandlerAsync, atLoc, range,
2085-
implicit),
2086-
AsyncFunctionDecl(&asyncFunctionDecl) ,
2087-
CompletionHandlerIndex(completionHandlerIndex),
2088-
CompletionHandlerIndexLoc(completionHandlerIndexLoc) {}
2089-
2090-
static bool classof(const DeclAttribute *DA) {
2091-
return DA->getKind() == DAK_CompletionHandlerAsync;
2092-
}
2093-
};
2094-
20952055
/// Attributes that may be applied to declarations.
20962056
class DeclAttributes {
20972057
/// Linked list of declaration attributes.

include/swift/AST/Decl.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6168,9 +6168,22 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
61686168
/// constructor.
61696169
bool hasDynamicSelfResult() const;
61706170

6171-
6171+
/// The async function marked as the alternative to this function, if any.
61726172
AbstractFunctionDecl *getAsyncAlternative() const;
61736173

6174+
/// If \p asyncAlternative is set, then compare its parameters to this
6175+
/// (presumed synchronous) function's parameters to find the index of the
6176+
/// completion handler parameter. This should be the the only missing
6177+
/// parameter in \p asyncAlternative, ignoring defaulted parameters if they
6178+
/// have the same label. It must have a void-returning function type and be
6179+
/// attributed with @escaping but not @autoclosure.
6180+
///
6181+
/// Returns the last index of the parameter that looks like a completion
6182+
/// handler if \p asyncAlternative is not set (with the same conditions on
6183+
/// its type as above).
6184+
Optional<unsigned> findPotentialCompletionHandlerParam(
6185+
const AbstractFunctionDecl *asyncAlternative = nullptr) const;
6186+
61746187
/// Determine whether this function is implicitly known to have its
61756188
/// parameters of function type be @_unsafeSendable.
61766189
///
@@ -6563,6 +6576,10 @@ class AccessorDecl final : public FuncDecl {
65636576
Bits.AccessorDecl.IsTransparentComputed = 1;
65646577
}
65656578

6579+
/// A representation of the name to be displayed to users. \c getNameStr
6580+
/// for anything other than a getter or setter.
6581+
void printUserFacingName(llvm::raw_ostream &out) const;
6582+
65666583
static bool classof(const Decl *D) {
65676584
return D->getKind() == DeclKind::Accessor;
65686585
}

include/swift/AST/DiagnosticsCommon.def

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ ERROR(scanner_find_cycle, none,
192192
ERROR(scanner_arguments_invalid, none,
193193
"dependencies scanner cannot be configured with arguments: '%0'", (StringRef))
194194

195+
WARNING(warn_scaner_deserialize_failed, none,
196+
"Failed to load module scanning dependency cache from: '%0', re-building scanner cache from scratch.", (StringRef))
197+
198+
REMARK(remark_reuse_cache, none,
199+
"Re-using serialized module scanning dependency cache from: '%0'.", (StringRef))
200+
201+
REMARK(remark_save_cache, none,
202+
"Serializing module scanning dependency cache to: '%0'.", (StringRef))
203+
195204
//------------------------------------------------------------------------------
196205
// MARK: custom attribute diagnostics
197206
//------------------------------------------------------------------------------

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ ERROR(error_mode_cannot_emit_module_summary,none,
129129
"this mode does not support emitting module summary files", ())
130130
ERROR(error_mode_cannot_emit_symbol_graph,none,
131131
"this mode does not support emitting symbol graph files", ())
132+
ERROR(error_mode_cannot_emit_abi_descriptor,none,
133+
"this mode does not support emitting ABI descriptor", ())
132134
ERROR(cannot_emit_ir_skipping_function_bodies,none,
133135
"the -experimental-skip-*-function-bodies* flags do not support "
134136
"emitting IR", ())

include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ ERROR(not_inheriting_convenience_inits,none,"%0 no longer inherits convenience i
8888

8989
ERROR(enum_case_added,none,"%0 has been added as a new enum case", (StringRef))
9090

91+
ERROR(demangled_name_changed,none,"%0 has mangled name changing from '%1' to '%2'", (StringRef, StringRef, StringRef))
92+
9193
WARNING(cannot_read_allowlist,none,"cannot read breakage allowlist at '%0'", (StringRef))
9294

9395
#define UNDEFINE_DIAGNOSTIC_MACROS

include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,11 +1690,6 @@ ERROR(sil_inst_autodiff_invalid_witness_generic_signature,PointsToFirstBadToken,
16901690
"parameters as original function generic signature '%1'",
16911691
(StringRef, StringRef))
16921692

1693-
// completionHandlerAsync
1694-
ERROR(attr_completion_handler_async_invalid_name, none,
1695-
"argument of '%0' attribute must be an identifier or full function name",
1696-
(StringRef))
1697-
16981693
//------------------------------------------------------------------------------
16991694
// MARK: Generics parsing diagnostics
17001695
//------------------------------------------------------------------------------

0 commit comments

Comments
 (0)