Skip to content

Commit f79fd45

Browse files
Merge pull request #1411 from swiftwasm/master
[pull] swiftwasm from master
2 parents 7ba2f72 + 241c5d9 commit f79fd45

File tree

84 files changed

+1386
-1233
lines changed

Some content is hidden

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

84 files changed

+1386
-1233
lines changed

include/swift/AST/SILOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ class SILOptions {
4040
/// Controls the aggressiveness of the loop unroller.
4141
int UnrollThreshold = 250;
4242

43-
/// Controls whether to pull in SIL from partial modules during the
44-
/// merge modules step. Could perhaps be merged with the link mode
45-
/// above but the interactions between all the flags are tricky.
46-
bool MergePartialModules = false;
47-
4843
/// Remove all runtime assertions during optimizations.
4944
bool RemoveRuntimeAsserts = false;
5045

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,7 @@ class HasImplementationOnlyImportsRequest
24442444

24452445
class ResolveTypeRequest
24462446
: public SimpleRequest<ResolveTypeRequest,
2447-
Type(TypeResolution *, TypeRepr *),
2447+
Type(const TypeResolution *, TypeRepr *),
24482448
RequestFlags::Uncached> {
24492449
public:
24502450
using SimpleRequest::SimpleRequest;
@@ -2457,7 +2457,7 @@ class ResolveTypeRequest
24572457
friend SimpleRequest;
24582458

24592459
// Evaluation.
2460-
Type evaluate(Evaluator &evaluator, TypeResolution *resolution,
2460+
Type evaluate(Evaluator &evaluator, const TypeResolution *resolution,
24612461
TypeRepr *repr) const;
24622462
};
24632463

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ SWIFT_REQUEST(TypeChecker, ResolveTypeEraserTypeRequest,
240240
Type(ProtocolDecl *, TypeEraserAttr *),
241241
SeparatelyCached, NoLocationInfo)
242242
SWIFT_REQUEST(TypeChecker, ResolveTypeRequest,
243-
Type (TypeResolution *, TypeRepr *), Uncached, NoLocationInfo)
243+
Type (const TypeResolution *, TypeRepr *),
244+
Uncached, NoLocationInfo)
244245
SWIFT_REQUEST(TypeChecker, SPIGroupsRequest,
245246
llvm::ArrayRef<Identifier>(Decl *),
246247
Cached, NoLocationInfo)

include/swift/ClangImporter/BuiltinMappedTypes.def

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,32 @@
2121
// - CLANG_BUILTIN_KIND is the kind of builtin type, clang::BuiltinType
2222
// - SWIFT_TYPE_NAME is the name of the corresponding stdlib type.
2323
//
24+
// MAP_BUILTIN_CCHAR_TYPE(CLANG_BUILTIN_KIND, SWIFT_TYPE_NAME)
25+
// - CLANG_BUILTIN_KIND is the kind of builtin type, clang::BuiltinType
26+
// - SWIFT_TYPE_NAME is the name of the corresponding stdlib type.
27+
//
2428
//===----------------------------------------------------------------------===//
2529

2630
#ifndef MAP_BUILTIN_INTEGER_TYPE
2731
#define MAP_BUILTIN_INTEGER_TYPE(CLANG, SWIFT) MAP_BUILTIN_TYPE(CLANG, SWIFT)
2832
#endif
2933

34+
#ifndef MAP_BUILTIN_CCHAR_TYPE
35+
#define MAP_BUILTIN_CCHAR_TYPE(CLANG, SWIFT) MAP_BUILTIN_TYPE(CLANG, SWIFT)
36+
#endif
37+
38+
MAP_BUILTIN_CCHAR_TYPE(Char_U, CChar)
39+
MAP_BUILTIN_CCHAR_TYPE(Char_S, CChar)
40+
MAP_BUILTIN_CCHAR_TYPE(WChar_S, CWideChar)
41+
MAP_BUILTIN_CCHAR_TYPE(WChar_U, CWideChar)
42+
3043
MAP_BUILTIN_TYPE(Bool, CBool)
31-
MAP_BUILTIN_INTEGER_TYPE(Char_U, CChar)
32-
MAP_BUILTIN_INTEGER_TYPE(Char_S, CChar)
3344
MAP_BUILTIN_INTEGER_TYPE(UChar, CUnsignedChar)
3445
MAP_BUILTIN_INTEGER_TYPE(UShort, CUnsignedShort)
3546
MAP_BUILTIN_INTEGER_TYPE(UInt, CUnsignedInt)
3647
MAP_BUILTIN_INTEGER_TYPE(ULong, CUnsignedLong)
3748
MAP_BUILTIN_INTEGER_TYPE(ULongLong, CUnsignedLongLong)
3849
MAP_BUILTIN_INTEGER_TYPE(UInt128, CUnsignedInt128)
39-
MAP_BUILTIN_INTEGER_TYPE(WChar_S, CWideChar)
40-
MAP_BUILTIN_INTEGER_TYPE(WChar_U, CWideChar)
4150
MAP_BUILTIN_INTEGER_TYPE(Char16, CChar16)
4251
MAP_BUILTIN_INTEGER_TYPE(Char32, CChar32)
4352
MAP_BUILTIN_INTEGER_TYPE(SChar, CSignedChar)
@@ -54,4 +63,4 @@ MAP_BUILTIN_TYPE(LongDouble, CLongDouble)
5463

5564
#undef MAP_BUILTIN_TYPE
5665
#undef MAP_BUILTIN_INTEGER_TYPE
57-
66+
#undef MAP_BUILTIN_CCHAR_TYPE

include/swift/Option/FrontendOptions.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,8 +554,9 @@ 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.
557558
def sil_merge_partial_modules : Flag<["-"], "sil-merge-partial-modules">,
558-
HelpText<"Merge SIL from all partial swiftmodules into the final module">;
559+
Alias<merge_modules>;
559560

560561
def sil_verify_all : Flag<["-"], "sil-verify-all">,
561562
HelpText<"Verify SIL after each transform">;

include/swift/SIL/SILModule.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,10 +561,6 @@ class SILModule {
561561
/// i.e. it can be linked by linkFunction.
562562
bool hasFunction(StringRef Name);
563563

564-
/// Link all definitions in all segments that are logically part of
565-
/// the same AST module.
566-
void linkAllFromCurrentModule();
567-
568564
/// Look up the SILWitnessTable representing the lowering of a protocol
569565
/// conformance, and collect the substitutions to apply to the referenced
570566
/// witnesses, if any.

include/swift/Serialization/SerializedSILLoader.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,6 @@ class SerializedSILLoader {
7474

7575
bool invalidateFunction(SILFunction *F);
7676

77-
/// Deserialize all SILFunctions, VTables, and WitnessTables in all
78-
/// SILModules.
79-
void getAll();
80-
8177
/// Deserialize all SILFunctions, VTables, and WitnessTables for
8278
/// a given Module.
8379
///

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2908,11 +2908,12 @@ void ClangModuleUnit::lookupValue(DeclName name, NLKind lookupKind,
29082908
bool ClangImporter::Implementation::isVisibleClangEntry(
29092909
const clang::NamedDecl *clangDecl) {
29102910
// For a declaration, check whether the declaration is hidden.
2911-
if (!clangDecl->isHidden()) return true;
2911+
clang::Sema &clangSema = getClangSema();
2912+
if (clangSema.isVisible(clangDecl)) return true;
29122913

29132914
// Is any redeclaration visible?
29142915
for (auto redecl : clangDecl->redecls()) {
2915-
if (!cast<clang::NamedDecl>(redecl)->isHidden()) return true;
2916+
if (clangSema.isVisible(cast<clang::NamedDecl>(redecl))) return true;
29162917
}
29172918

29182919
return false;
@@ -3023,8 +3024,10 @@ void ClangImporter::loadExtensions(NominalTypeDecl *nominal,
30233024
SmallVector<clang::NamedDecl *, 4> DelayedCategories;
30243025

30253026
// Simply importing the categories adds them to the list of extensions.
3026-
for (const auto *Cat : objcClass->visible_categories()) {
3027-
Impl.importDeclReal(Cat, Impl.CurrentVersion);
3027+
for (const auto *Cat : objcClass->known_categories()) {
3028+
if (getClangSema().isVisible(Cat)) {
3029+
Impl.importDeclReal(Cat, Impl.CurrentVersion);
3030+
}
30283031
}
30293032
}
30303033

lib/ClangImporter/ImportDecl.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7097,9 +7097,12 @@ void SwiftDeclConverter::importMirroredProtocolMembers(
70977097
return;
70987098

70997099
bool inNearbyCategory =
7100-
std::any_of(interfaceDecl->visible_categories_begin(),
7101-
interfaceDecl->visible_categories_end(),
7100+
std::any_of(interfaceDecl->known_categories_begin(),
7101+
interfaceDecl->known_categories_end(),
71027102
[=](const clang::ObjCCategoryDecl *category) -> bool {
7103+
if (!Impl.getClangSema().isVisible(category)) {
7104+
return false;
7105+
}
71037106
if (category != decl) {
71047107
auto *categoryModule =
71057108
Impl.getClangModuleForDecl(category);

lib/ClangImporter/ImportType.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ namespace {
236236
case clang::BuiltinType::CLANG_BUILTIN_KIND: \
237237
return unwrapCType(Impl.getNamedSwiftType(Impl.getStdlibModule(), \
238238
#SWIFT_TYPE_NAME));
239-
239+
#define MAP_BUILTIN_CCHAR_TYPE(CLANG_BUILTIN_KIND, SWIFT_TYPE_NAME) \
240+
case clang::BuiltinType::CLANG_BUILTIN_KIND: \
241+
return Impl.getNamedSwiftType(Impl.getStdlibModule(), #SWIFT_TYPE_NAME);
240242
#include "swift/ClangImporter/BuiltinMappedTypes.def"
241243

242244
// Types that cannot be mapped into Swift, and probably won't ever be.

0 commit comments

Comments
 (0)