Skip to content

Commit dedf920

Browse files
Merge pull request #4914 from swiftwasm/main
[pull] swiftwasm from main
2 parents 8e2626e + 81c3a11 commit dedf920

34 files changed

+286
-76
lines changed

CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,8 +877,14 @@ endif()
877877

878878
# When we have the early SwiftSyntax build, we can include its parser.
879879
if(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR)
880-
set(SWIFT_SWIFT_PARSER TRUE)
881-
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
880+
set(SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS
881+
${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/cmake/SwiftSyntaxTargets.cmake)
882+
if(NOT EXISTS "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS}")
883+
message(STATUS "Skipping Swift Swift parser integration due to missing early SwiftSyntax")
884+
else()
885+
set(SWIFT_SWIFT_PARSER TRUE)
886+
include(${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_TARGETS})
887+
endif()
882888
endif()
883889

884890

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function(add_swift_unittest test_dirname)
8181

8282
if (SWIFT_SWIFT_PARSER)
8383
_add_swift_runtime_link_flags(${test_dirname} "../../lib" "")
84+
set_property(TARGET ${test_dirname} PROPERTY BUILD_WITH_INSTALL_RPATH OFF)
8485
endif()
8586
endfunction()
8687

include/swift/AST/Decl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,12 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
10491049

10501050
bool isAvailableAsSPI() const;
10511051

1052+
/// Whether the declaration is considered unavailable through either being
1053+
/// explicitly marked as such, or has a parent decl that is semantically
1054+
/// unavailable. This is a broader notion of unavailability than is checked by
1055+
/// \c AvailableAttr::isUnavailable.
1056+
bool isSemanticallyUnavailable() const;
1057+
10521058
// List the SPI groups declared with @_spi or inherited by this decl.
10531059
//
10541060
// SPI groups are inherited from the parent contexts only if the local decl

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,8 +3014,8 @@ NOTE(spi_only_import_conflict_here,none,
30143014
"imported for SPI only here", ())
30153015

30163016
ERROR(error_public_import_of_private_module,none,
3017-
"private module %0 is imported publicly from the public module %1",
3018-
(Identifier, Identifier))
3017+
"private module %0 is imported publicly from the public module %1",
3018+
(Identifier, Identifier))
30193019

30203020
ERROR(implementation_only_decl_non_override,none,
30213021
"'@_implementationOnly' can only be used on overrides", ())

include/swift/AST/TypeCheckRequests.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3489,6 +3489,22 @@ class RenamedDeclRequest
34893489
bool isCached() const { return true; }
34903490
};
34913491

3492+
class IsSemanticallyUnavailableRequest
3493+
: public SimpleRequest<IsSemanticallyUnavailableRequest,
3494+
bool(const Decl *),
3495+
RequestFlags::Cached> {
3496+
public:
3497+
using SimpleRequest::SimpleRequest;
3498+
3499+
private:
3500+
friend SimpleRequest;
3501+
3502+
bool evaluate(Evaluator &evaluator, const Decl *decl) const;
3503+
3504+
public:
3505+
bool isCached() const { return true; }
3506+
};
3507+
34923508
class ClosureEffectsRequest
34933509
: public SimpleRequest<ClosureEffectsRequest,
34943510
FunctionType::ExtInfo(ClosureExpr *),

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ SWIFT_REQUEST(TypeChecker, GetImplicitSendableRequest,
395395
SWIFT_REQUEST(TypeChecker, RenamedDeclRequest,
396396
ValueDecl *(const ValueDecl *, const AvailableAttr *),
397397
Cached, NoLocationInfo)
398+
SWIFT_REQUEST(TypeChecker, IsSemanticallyUnavailableRequest,
399+
bool(const Decl *),
400+
Cached, NoLocationInfo)
398401
SWIFT_REQUEST(TypeChecker, ClosureEffectsRequest,
399402
FunctionType::ExtInfo(ClosureExpr *),
400403
Cached, NoLocationInfo)

include/swift/Basic/Features.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ EXPERIMENTAL_FEATURE(ParserRoundTrip)
134134
/// Swift parser.
135135
EXPERIMENTAL_FEATURE(ParserValidation)
136136

137+
/// Whether to fold sequence expressions in the syntax tree produced by the
138+
/// Swift Swift parser.
139+
EXPERIMENTAL_FEATURE(ParserSequenceFolding)
140+
137141
#undef EXPERIMENTAL_FEATURE
138142
#undef UPCOMING_FEATURE
139143
#undef SUPPRESSIBLE_LANGUAGE_FEATURE

include/swift/SIL/SILDeclRef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ struct SILDeclRef {
300300
/// Retrieves the ASTContext from the underlying AST node being stored.
301301
ASTContext &getASTContext() const;
302302

303+
/// Retrieve the innermost declaration context corresponding to the underlying
304+
/// node, which will either be the node itself (if it's also a declaration
305+
/// context) or its parent context.
306+
DeclContext *getInnermostDeclContext() const;
307+
303308
llvm::Optional<AnyFunctionRef> getAnyFunctionRef() const;
304309

305310
SILLocation getAsRegularLocation() const;

include/swift/SIL/SILProfiler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SILFunction;
3232
class SILModule;
3333

3434
/// Returns whether the given AST node requires profiling instrumentation.
35-
bool doesASTRequireProfiling(SILModule &M, ASTNode N);
35+
bool doesASTRequireProfiling(SILModule &M, ASTNode N, SILDeclRef Constant);
3636

3737
/// SILProfiler - Maps AST nodes to profile counters.
3838
class SILProfiler : public SILAllocated<SILProfiler> {

include/swift/Sema/CompletionContextFinder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ class CompletionContextFinder : public ASTWalker {
9191
return CompletionNode.dyn_cast<const KeyPathExpr *>() != nullptr;
9292
}
9393

94+
bool hasCompletion() const {
95+
return !CompletionNode.isNull();
96+
}
97+
9498
/// If we are completing in a key path, returns the \c KeyPath that contains
9599
/// the code completion component.
96100
const KeyPathExpr *getKeyPathContainingCompletionComponent() const {

0 commit comments

Comments
 (0)