Skip to content

Commit 5a824de

Browse files
authored
Merge pull request #1426 from swiftwasm/master
[pull] swiftwasm from master
2 parents d495229 + bfc63de commit 5a824de

File tree

110 files changed

+3710
-3440
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

+3710
-3440
lines changed

include/swift/ABI/MetadataValues.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,9 @@ namespace SpecialPointerAuthDiscriminators {
11181118
/// Runtime function variables exported by the runtime.
11191119
const uint16_t RuntimeFunctionEntry = 0x625b;
11201120

1121+
/// Protocol conformance descriptors.
1122+
const uint16_t ProtocolConformanceDescriptor = 0xc6eb;
1123+
11211124
/// Value witness functions.
11221125
const uint16_t InitializeBufferWithCopyOfBuffer = 0xda4a;
11231126
const uint16_t Destroy = 0x04f8;

include/swift/AST/ASTTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ SWIFT_TYPEID_NAMED(ConstructorDecl *, ConstructorDecl)
4040
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
4141
SWIFT_TYPEID_NAMED(Decl *, Decl)
4242
SWIFT_TYPEID_NAMED(EnumDecl *, EnumDecl)
43+
SWIFT_TYPEID_NAMED(FuncDecl *, FuncDecl)
4344
SWIFT_TYPEID_NAMED(GenericParamList *, GenericParamList)
4445
SWIFT_TYPEID_NAMED(GenericTypeParamType *, GenericTypeParamType)
4546
SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)

include/swift/AST/ASTTypeIDs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ConstructorDecl;
3030
class CustomAttr;
3131
class Decl;
3232
class EnumDecl;
33+
class FuncDecl;
3334
enum class FunctionBuilderBodyPreCheck : uint8_t;
3435
class GenericParamList;
3536
class GenericSignature;

include/swift/AST/DiagnosticsDriver.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ ERROR(cannot_find_migration_script, none,
186186
ERROR(error_darwin_static_stdlib_not_supported, none,
187187
"-static-stdlib is no longer supported on Apple platforms", ())
188188

189+
ERROR(error_darwin_only_supports_libcxx, none,
190+
"The only C++ standard library supported on Apple platforms is libc++",
191+
())
192+
189193
WARNING(warn_drv_darwin_sdk_invalid_settings, none,
190194
"SDK settings were ignored because 'SDKSettings.json' could not be parsed",
191195
())

include/swift/AST/IRGenOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ struct PointerAuthOptions : clang::PointerAuthOptions {
123123
/// Type descriptor data pointers when passed as arguments.
124124
PointerAuthSchema TypeDescriptorsAsArguments;
125125

126+
/// Protocol conformance descriptors.
127+
PointerAuthSchema ProtocolConformanceDescriptors;
128+
129+
/// Protocol conformance descriptors when passed as arguments.
130+
PointerAuthSchema ProtocolConformanceDescriptorsAsArguments;
131+
126132
/// Resumption functions from yield-once coroutines.
127133
PointerAuthSchema YieldOnceResumeFunctions;
128134

include/swift/AST/PlatformKinds.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
AVAILABILITY_PLATFORM(iOS, "iOS")
2626
AVAILABILITY_PLATFORM(tvOS, "tvOS")
2727
AVAILABILITY_PLATFORM(watchOS, "watchOS")
28-
AVAILABILITY_PLATFORM(OSX, "macOS")
28+
AVAILABILITY_PLATFORM(macOS, "macOS")
2929
AVAILABILITY_PLATFORM(iOSApplicationExtension, "application extensions for iOS")
3030
AVAILABILITY_PLATFORM(tvOSApplicationExtension, "application extensions for tvOS")
3131
AVAILABILITY_PLATFORM(watchOSApplicationExtension, "application extensions for watchOS")
32-
AVAILABILITY_PLATFORM(OSXApplicationExtension, "application extensions for macOS")
32+
AVAILABILITY_PLATFORM(macOSApplicationExtension, "application extensions for macOS")
3333
AVAILABILITY_PLATFORM(macCatalyst, "Mac Catalyst")
3434
AVAILABILITY_PLATFORM(macCatalystApplicationExtension, "application extensions for Mac Catalyst")
3535

include/swift/AST/TypeCheckRequests.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2564,6 +2564,23 @@ class CustomAttrTypeRequest
25642564
void cacheResult(Type value) const;
25652565
};
25662566

2567+
class SynthesizeMainFunctionRequest
2568+
: public SimpleRequest<SynthesizeMainFunctionRequest,
2569+
FuncDecl *(Decl *),
2570+
RequestFlags::Cached> {
2571+
public:
2572+
using SimpleRequest::SimpleRequest;
2573+
2574+
private:
2575+
friend SimpleRequest;
2576+
2577+
// Evaluation.
2578+
FuncDecl *evaluate(Evaluator &evaluator, Decl *) const;
2579+
2580+
public:
2581+
bool isCached() const { return true; }
2582+
};
2583+
25672584
// Allow AnyValue to compare two Type values, even though Type doesn't
25682585
// support ==.
25692586
template<>

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,3 +274,5 @@ SWIFT_REQUEST(TypeChecker, LookupAllConformancesInContextRequest,
274274
Uncached, NoLocationInfo)
275275
SWIFT_REQUEST(TypeChecker, SimpleDidSetRequest,
276276
bool(AccessorDecl *), Cached, NoLocationInfo)
277+
SWIFT_REQUEST(TypeChecker, SynthesizeMainFunctionRequest,
278+
FuncDecl *(Decl *), Cached, NoLocationInfo)

include/swift/Driver/Compilation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ namespace driver {
5656
enum class OutputLevel {
5757
/// Indicates that normal output should be produced.
5858
Normal,
59-
59+
6060
/// Indicates that only jobs should be printed and not run. (-###)
6161
PrintJobs,
6262

@@ -83,7 +83,7 @@ class Compilation {
8383
const bool &EnableIncrementalBuild;
8484
const bool EnableSourceRangeDependencies;
8585

86-
/// If not empty, the path to use to log the comparision.
86+
/// If not empty, the path to use to log the comparison.
8787
const StringRef CompareIncrementalSchemesPath;
8888

8989
const unsigned SwiftInputCount;

include/swift/Driver/ToolChain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ class ToolChain {
294294
void getClangLibraryPath(const llvm::opt::ArgList &Args,
295295
SmallString<128> &LibPath) const;
296296

297+
// Returns the Clang driver executable to use for linking.
298+
const char *getClangLinkerDriver(const llvm::opt::ArgList &Args) const;
299+
297300
/// Returns the name the clang library for a given sanitizer would have on
298301
/// the current toolchain.
299302
///

include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class ExplicitSwiftModuleLoader: public SerializedModuleLoaderBase {
141141
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
142142
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer) override;
143143

144+
bool canImportModule(Located<Identifier> mID) override;
145+
144146
bool isCached(StringRef DepPath) override { return false; };
145147

146148
struct Implementation;

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,6 @@ def sil_unroll_threshold : Separate<["-"], "sil-unroll-threshold">,
554554
MetaVarName<"<250>">,
555555
HelpText<"Controls the aggressiveness of loop unrolling">;
556556

557-
// FIXME: This option is now redundant and should eventually be removed.
558-
def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
559-
Alias<merge_modules>;
560-
561557
def sil_verify_all : Flag<["-"], "sil-verify-all">,
562558
HelpText<"Verify SIL after each transform">;
563559

include/swift/Option/Options.td

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Flag<["-"], "enable-only-one-dependency-file">, Flags<[DoesNotAffectIncrementalB
154154
def disable_only_one_dependency_file :
155155
Flag<["-"], "disable-only-one-dependency-file">, Flags<[DoesNotAffectIncrementalBuild]>,
156156
HelpText<"Disables incremental build optimization that only produces one dependencies file">;
157-
157+
158158

159159
def enable_source_range_dependencies :
160160
Flag<["-"], "enable-source-range-dependencies">, Flags<[]>,
@@ -167,7 +167,7 @@ HelpText<"Print a simple message comparing dependencies with source ranges (w/ f
167167

168168
def driver_compare_incremental_schemes_path :
169169
Separate<["-"], "driver-compare-incremental-schemes-path">, Flags<[ArgumentIsPath,DoesNotAffectIncrementalBuild]>,
170-
HelpText<"Path to use for machine-readable comparision">,
170+
HelpText<"Path to use for machine-readable comparison">,
171171
MetaVarName<"<path>">;
172172

173173
def driver_compare_incremental_schemes_path_EQ :
@@ -556,6 +556,14 @@ def disable_direct_intramodule_dependencies : Flag<["-"],
556556
Flags<[FrontendOption, HelpHidden]>,
557557
HelpText<"Disable experimental dependency tracking that never cascades">;
558558

559+
def enable_experimental_cxx_interop :
560+
Flag<["-"], "enable-experimental-cxx-interop">,
561+
HelpText<"Allow importing C++ modules into Swift (experimental feature)">;
562+
563+
def experimental_cxx_stdlib :
564+
Separate<["-"], "experimental-cxx-stdlib">,
565+
HelpText<"C++ standard library to use; forwarded to Clang's -stdlib flag">;
566+
559567

560568
// Diagnostic control options
561569
def suppress_warnings : Flag<["-"], "suppress-warnings">,
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//===--- FoundationSupport.cpp - Support functions for Foundation ---------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2020 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
//
13+
// Helper functions for the Foundation framework.
14+
//
15+
//===----------------------------------------------------------------------===//
16+
17+
#ifndef SWIFT_RUNTIME_FOUNDATION_SUPPORT_H
18+
#define SWIFT_RUNTIME_FOUNDATION_SUPPORT_H
19+
20+
#include "swift/Runtime/Config.h"
21+
22+
#if SWIFT_OBJC_INTEROP
23+
#include <objc/runtime.h>
24+
25+
#ifdef __cplusplus
26+
namespace swift { extern "C" {
27+
#endif
28+
29+
/// Returns a boolean indicating whether the Objective-C name of a class type is
30+
/// stable across executions, i.e., if the class name is safe to serialize. (The
31+
/// names of private and local types are unstable.)
32+
SWIFT_RUNTIME_STDLIB_SPI
33+
bool _swift_isObjCTypeNameSerializable(Class theClass);
34+
35+
#ifdef __cplusplus
36+
}} // extern "C", namespace swift
37+
#endif
38+
39+
#endif // SWIFT_OBJC_INTEROP
40+
#endif // SWIFT_RUNTIME_FOUNDATION_SUPPORT_H

0 commit comments

Comments
 (0)