Skip to content

Commit 415d636

Browse files
authored
---
yaml --- r: 278523 b: refs/heads/swift-5.1-old-llvm-branch c: 7d0438b h: refs/heads/master i: 278521: 377eb13 278519: f854f03
1 parent a550679 commit 415d636

File tree

96 files changed

+3301
-1404
lines changed

Some content is hidden

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

96 files changed

+3301
-1404
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-01-24-a: b6f62823aa5010b2ae53f15f72a57
12411241
refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e0
12421242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
12431243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
1244-
refs/heads/swift-5.1-old-llvm-branch: b2776f33ceb39f4d29e2b6f32a91e7ba0f182c7d
1244+
refs/heads/swift-5.1-old-llvm-branch: 7d0438b4f5a9af67582c0778f1fe5e845bef856a
12451245
refs/heads/swift-5.1-branch: 8060872acb4105d9655e020fe047e1ebcd77d0fb
12461246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
12471247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e

branches/swift-5.1-old-llvm-branch/include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,8 @@ ERROR(cannot_return_value_from_void_func,none,
586586

587587
ERROR(sema_no_import,Fatal,
588588
"no such module '%0'", (StringRef))
589-
ERROR(sema_no_import_arch,Fatal,
590-
"could not find module '%0' for architecture '%1'; "
589+
ERROR(sema_no_import_target,Fatal,
590+
"could not find module '%0' for target '%1'; "
591591
"found: %2", (StringRef, StringRef, StringRef))
592592
ERROR(sema_no_import_repl,none,
593593
"no such module '%0'", (StringRef))

branches/swift-5.1-old-llvm-branch/include/swift/AST/NameLookup.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,25 @@ class UnqualifiedLookup {
118118
/// That is, \c makeArrayRef(Results).take_front(IndexOfFirstOuterResults)
119119
/// will be Results from the innermost scope that had results, and the
120120
/// remaining elements of Results will be from parent scopes of this one.
121+
///
122+
/// Allows unqualified name lookup to return results from outer scopes.
123+
/// This is necessary for disambiguating calls to functions like `min` and
124+
/// `max`.
121125
size_t IndexOfFirstOuterResult;
122126

123127
/// Return true if anything was found by the name lookup.
124128
bool isSuccess() const { return !Results.empty(); }
125129

126130
/// Get the result as a single type, or a null type if that fails.
127-
TypeDecl *getSingleTypeResult();
131+
TypeDecl *getSingleTypeResult() const;
128132
};
129133

130134
inline UnqualifiedLookup::Options operator|(UnqualifiedLookup::Flags flag1,
131135
UnqualifiedLookup::Flags flag2) {
132136
return UnqualifiedLookup::Options(flag1) | flag2;
133137
}
134138

139+
135140
/// Describes the reason why a certain declaration is visible.
136141
enum class DeclVisibilityKind {
137142
/// Declaration is a local variable or type.
@@ -352,6 +357,29 @@ void lookupInModule(ModuleDecl *module, ModuleDecl::AccessPathTy accessPath,
352357
const DeclContext *moduleScopeContext,
353358
ArrayRef<ModuleDecl::ImportedModule> extraImports = {});
354359

360+
template <typename Fn>
361+
void forAllVisibleModules(const DeclContext *DC, const Fn &fn) {
362+
DeclContext *moduleScope = DC->getModuleScopeContext();
363+
if (auto file = dyn_cast<FileUnit>(moduleScope))
364+
file->forAllVisibleModules(fn);
365+
else
366+
cast<ModuleDecl>(moduleScope)
367+
->forAllVisibleModules(ModuleDecl::AccessPathTy(), fn);
368+
}
369+
370+
/// Only name lookup has gathered a set of results, perform any necessary
371+
/// steps to prune the result set before returning it to the caller.
372+
bool finishLookup(const DeclContext *dc, NLOptions options,
373+
SmallVectorImpl<ValueDecl *> &decls);
374+
375+
/// Do nothing if debugClient is null.
376+
template <typename Result>
377+
void filterForDiscriminator(SmallVectorImpl<Result> &results,
378+
DebuggerClient *debugClient);
379+
380+
void recordLookupOfTopLevelName(DeclContext *topLevelContext, DeclName name,
381+
bool isCascading);
382+
355383
} // end namespace namelookup
356384

357385
/// Retrieve the set of nominal type declarations that are directly

branches/swift-5.1-old-llvm-branch/include/swift/Basic/Platform.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ namespace swift {
7474
///
7575
/// This is a stop-gap until full Triple support (ala Clang) exists within swiftc.
7676
StringRef getMajorArchitectureName(const llvm::Triple &triple);
77+
78+
/// Computes the normalized target triple used as the most preferred name for
79+
/// module loading.
80+
///
81+
/// For platforms with fat binaries, this canonicalizes architecture,
82+
/// vendor, and OS names, strips OS versions, and makes inferred environments
83+
/// explicit. For other platforms, it returns the unmodified triple.
84+
///
85+
/// The input triple should already be "normalized" in the sense that
86+
/// llvm::Triple::normalize() would not affect it.
87+
llvm::Triple getTargetSpecificModuleTriple(const llvm::Triple &triple);
7788
} // end namespace swift
7889

7990
#endif // SWIFT_BASIC_PLATFORM_H

branches/swift-5.1-old-llvm-branch/include/swift/Demangling/Demangle.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information
@@ -35,6 +35,11 @@ namespace Demangle {
3535

3636
enum class SymbolicReferenceKind : uint8_t;
3737

38+
/// A simple default implementation that assigns letters to archetypes in
39+
/// alphabetic order.
40+
std::string archetypeName(uint64_t index, uint64_t depth);
41+
42+
/// Display style options for the demangler.
3843
struct DemangleOptions {
3944
bool SynthesizeSugarOnTypes = false;
4045
bool DisplayDebuggerGeneratedModule = true;
@@ -52,6 +57,7 @@ struct DemangleOptions {
5257
bool ShortenArchetype = false;
5358
bool ShowPrivateDiscriminators = true;
5459
bool ShowFunctionArgumentTypes = true;
60+
std::function<std::string(uint64_t, uint64_t)> ArchetypeName = archetypeName;
5561

5662
DemangleOptions() {}
5763

@@ -346,17 +352,19 @@ class Context {
346352
/// prefix: _T, _T0, $S, _$S.
347353
///
348354
/// \returns The demangled string.
349-
std::string demangleSymbolAsString(llvm::StringRef MangledName,
350-
const DemangleOptions &Options = DemangleOptions());
355+
std::string demangleSymbolAsString(
356+
llvm::StringRef MangledName,
357+
const DemangleOptions &Options = DemangleOptions());
351358

352359
/// Demangle the given type and return the readable name.
353360
///
354361
/// \param MangledName The mangled type string, which does _not_ start with
355362
/// a mangling prefix.
356363
///
357364
/// \returns The demangled string.
358-
std::string demangleTypeAsString(llvm::StringRef MangledName,
359-
const DemangleOptions &Options = DemangleOptions());
365+
std::string
366+
demangleTypeAsString(llvm::StringRef MangledName,
367+
const DemangleOptions &Options = DemangleOptions());
360368

361369
/// Returns true if the mangledName refers to a thunk function.
362370
///
@@ -584,7 +592,6 @@ bool nodeConsumesGenericArgs(Node *node);
584592
bool isSpecialized(Node *node);
585593

586594
NodePointer getUnspecialized(Node *node, NodeFactory &Factory);
587-
std::string archetypeName(Node::IndexType index, Node::IndexType depth);
588595

589596
/// Returns true if the node \p kind refers to a context node, e.g. a nominal
590597
/// type or a function.

branches/swift-5.1-old-llvm-branch/include/swift/Remote/MetadataReader.h

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -410,11 +410,15 @@ class MetadataReader {
410410
StoredPointer InstanceAddress =
411411
InstanceMetadataAddressAddress + 2 * sizeof(StoredPointer);
412412

413+
// When built with Objective-C interop, the runtime also stores a conformance
414+
// to Hashable and the base type introducing the Hashable conformance.
415+
if (isObjC)
416+
InstanceAddress += 2 * sizeof(StoredPointer);
417+
413418
// Round up to alignment, and we have the start address of the
414419
// instance payload.
415420
auto AlignmentMask = VWT->getAlignmentMask();
416-
auto Offset = (sizeof(HeapObject) + AlignmentMask) & ~AlignmentMask;
417-
InstanceAddress += Offset;
421+
InstanceAddress = (InstanceAddress + AlignmentMask) & ~AlignmentMask;
418422

419423
return RemoteExistential(
420424
RemoteAddress(*InstanceMetadataAddress),
@@ -2447,6 +2451,12 @@ class MetadataReader {
24472451
tryFindSymbol(_address, symbolName); \
24482452
tryReadSymbol(_address, dest); \
24492453
} while (0)
2454+
# define tryFindAndReadSymbolWithDefault(dest, symbolName, default) do { \
2455+
dest = default; \
2456+
auto _address = Reader->getSymbolAddress(symbolName); \
2457+
if (_address) \
2458+
tryReadSymbol(_address, dest); \
2459+
} while (0)
24502460

24512461
tryFindAndReadSymbol(TaggedPointerMask,
24522462
"objc_debug_taggedpointer_mask");
@@ -2459,30 +2469,34 @@ class MetadataReader {
24592469
if (!TaggedPointerClassesAddr)
24602470
finish(TaggedPointerEncodingKind::Error);
24612471
TaggedPointerClasses = TaggedPointerClassesAddr.getAddressData();
2462-
tryFindAndReadSymbol(TaggedPointerExtendedMask,
2463-
"objc_debug_taggedpointer_ext_mask");
2464-
tryFindAndReadSymbol(TaggedPointerExtendedSlotShift,
2465-
"objc_debug_taggedpointer_ext_slot_shift");
2466-
tryFindAndReadSymbol(TaggedPointerExtendedSlotMask,
2467-
"objc_debug_taggedpointer_ext_slot_mask");
2468-
tryFindSymbol(TaggedPointerExtendedClassesAddr,
2469-
"objc_debug_taggedpointer_ext_classes");
2470-
if (!TaggedPointerExtendedClassesAddr)
2471-
finish(TaggedPointerEncodingKind::Error);
2472-
TaggedPointerExtendedClasses =
2473-
TaggedPointerExtendedClassesAddr.getAddressData();
2472+
2473+
// Extended tagged pointers don't exist on older OSes. Handle those
2474+
// by setting the variables to zero.
2475+
tryFindAndReadSymbolWithDefault(TaggedPointerExtendedMask,
2476+
"objc_debug_taggedpointer_ext_mask",
2477+
0);
2478+
tryFindAndReadSymbolWithDefault(TaggedPointerExtendedSlotShift,
2479+
"objc_debug_taggedpointer_ext_slot_shift",
2480+
0);
2481+
tryFindAndReadSymbolWithDefault(TaggedPointerExtendedSlotMask,
2482+
"objc_debug_taggedpointer_ext_slot_mask",
2483+
0);
2484+
auto TaggedPointerExtendedClassesAddr =
2485+
Reader->getSymbolAddress("objc_debug_taggedpointer_ext_classes");
2486+
if (TaggedPointerExtendedClassesAddr)
2487+
TaggedPointerExtendedClasses =
2488+
TaggedPointerExtendedClassesAddr.getAddressData();
24742489

24752490
// The tagged pointer obfuscator is not present on older OSes, in
24762491
// which case we can treat it as zero.
2477-
TaggedPointerObfuscator = 0;
2478-
auto TaggedPointerObfuscatorAddr = Reader->getSymbolAddress(
2479-
"objc_debug_taggedpointer_obfuscator");
2480-
if (TaggedPointerObfuscatorAddr)
2481-
tryReadSymbol(TaggedPointerObfuscatorAddr, TaggedPointerObfuscator);
2482-
2492+
tryFindAndReadSymbolWithDefault(TaggedPointerObfuscator,
2493+
"objc_debug_taggedpointer_obfuscator",
2494+
0);
2495+
24832496
# undef tryFindSymbol
24842497
# undef tryReadSymbol
24852498
# undef tryFindAndReadSymbol
2499+
# undef tryFindAndReadSymbolWithDefault
24862500

24872501
return finish(TaggedPointerEncodingKind::Extended);
24882502
}

branches/swift-5.1-old-llvm-branch/include/swift/SIL/OptimizationRemark.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ struct Argument {
5050
Argument(StringRef Key, unsigned long long N);
5151

5252
Argument(StringRef Key, SILFunction *F);
53-
Argument(StringRef Key, SILType *Ty);
53+
Argument(StringRef Key, SILType Ty);
54+
Argument(StringRef Key, CanType Ty);
5455
};
5556

5657
/// Shorthand to insert named-value pairs.

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILBuilder.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,10 @@ class SILBuilder {
918918
} \
919919
Copy##Name##ValueInst *createCopy##Name##Value(SILLocation Loc, \
920920
SILValue operand) { \
921+
auto type = getFunction().getLoweredType( \
922+
operand->getType().getASTType().getReferenceStorageReferent()); \
921923
return insert(new (getModule()) \
922-
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, getModule())); \
924+
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, type)); \
923925
}
924926
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
925927
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...") \

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILFunction.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ class SILModule;
3838
class SILFunctionBuilder;
3939
class SILProfiler;
4040

41+
namespace Lowering {
42+
class TypeLowering;
43+
class AbstractionPattern;
44+
}
45+
4146
enum IsBare_t { IsNotBare, IsBare };
4247
enum IsTransparent_t { IsNotTransparent, IsTransparent };
4348
enum Inline_t { InlineDefault, NoInline, AlwaysInline };
@@ -464,6 +469,19 @@ class SILFunction
464469
: ResilienceExpansion::Maximal);
465470
}
466471

472+
const Lowering::TypeLowering &
473+
getTypeLowering(Lowering::AbstractionPattern orig, Type subst);
474+
475+
const Lowering::TypeLowering &getTypeLowering(Type t) const;
476+
477+
SILType getLoweredType(Lowering::AbstractionPattern orig, Type subst) const;
478+
479+
SILType getLoweredType(Type t) const;
480+
481+
SILType getLoweredLoadableType(Type t) const;
482+
483+
const Lowering::TypeLowering &getTypeLowering(SILType type) const;
484+
467485
/// Returns true if this function has a calling convention that has a self
468486
/// argument.
469487
bool hasSelfParam() const {

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILInstruction.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,30 +3929,26 @@ class StoreReferenceInstBase : public InstructionBase<K, NonValueInstruction> {
39293929
/// \param loc The location of the expression that caused the load.
39303930
/// \param lvalue The SILValue representing the address to
39313931
/// use for the load.
3932-
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3932+
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
39333933
class Load##Name##Inst \
39343934
: public LoadReferenceInstBase<SILInstructionKind::Load##Name##Inst> { \
39353935
friend SILBuilder; \
39363936
Load##Name##Inst(SILDebugLocation loc, SILValue lvalue, IsTake_t isTake) \
39373937
: LoadReferenceInstBase(loc, lvalue, isTake) {} \
39383938
};
3939-
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3940-
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...")
39413939
#include "swift/AST/ReferenceStorage.def"
39423940

39433941
/// Represents a store to a dynamic reference storage memory location.
39443942
/// This is only required for address-only scenarios; for loadable
39453943
/// references, it's better to use a ref_to_##name and a store.
3946-
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3944+
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
39473945
class Store##Name##Inst \
39483946
: public StoreReferenceInstBase<SILInstructionKind::Store##Name##Inst> { \
39493947
friend SILBuilder; \
39503948
Store##Name##Inst(SILDebugLocation loc, SILValue src, SILValue dest, \
39513949
IsInitialization_t isInit) \
39523950
: StoreReferenceInstBase(loc, src, dest, isInit) {} \
39533951
};
3954-
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3955-
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...")
39563952
#include "swift/AST/ReferenceStorage.def"
39573953

39583954
/// CopyAddrInst - Represents a copy from one memory location to another. This
@@ -6332,9 +6328,8 @@ class Copy##Name##ValueInst \
63326328
SingleValueInstruction> { \
63336329
friend class SILBuilder; \
63346330
Copy##Name##ValueInst(SILDebugLocation DebugLoc, SILValue operand, \
6335-
SILModule &M) \
6336-
: UnaryInstructionBase(DebugLoc, operand, \
6337-
operand->getType().getReferentType(M)) {} \
6331+
SILType type) \
6332+
: UnaryInstructionBase(DebugLoc, operand, type) {} \
63386333
};
63396334
#include "swift/AST/ReferenceStorage.def"
63406335

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILModule.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,10 @@ class SILModule {
598598

599599
/// Can value operations (copies and destroys) on the given lowered type
600600
/// be performed in this module?
601-
bool isTypeABIAccessible(SILType type);
601+
// FIXME: Expansion
602+
bool isTypeABIAccessible(SILType type,
603+
ResilienceExpansion forExpansion
604+
= ResilienceExpansion::Minimal);
602605

603606
/// Can type metadata for the given formal type be fetched in
604607
/// the given module?

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILType.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,6 @@ class SILType {
477477
/// representation. Class existentials do not always qualify.
478478
bool isHeapObjectReferenceType() const;
479479

480-
/// Return the SILType corresponding to the underlying type of the given
481-
/// metatype type.
482-
///
483-
/// *NOTE* Only call on SILTypes for metatype types.
484-
SILType getMetatypeInstanceType(SILModule& M) const;
485-
486480
/// Returns true if this SILType is an aggregate that contains \p Ty
487481
bool aggregateContainsRecord(SILType Ty, SILModule &SILMod) const;
488482

@@ -501,10 +495,6 @@ class SILType {
501495

502496
/// Returns true if this is the AnyObject SILType;
503497
bool isAnyObject() const { return getASTType()->isAnyObject(); }
504-
505-
/// Returns the underlying referent SILType of an @sil_unowned or @sil_weak
506-
/// Type.
507-
SILType getReferentType(SILModule &M) const;
508498

509499
/// Returns a SILType with any archetypes mapped out of context.
510500
SILType mapTypeOutOfContext() const;

branches/swift-5.1-old-llvm-branch/include/swift/SIL/TypeLowering.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,13 +769,16 @@ class TypeConverter {
769769
ResilienceExpansion::Minimal);
770770

771771
// Returns the lowered SIL type for a Swift type.
772-
SILType getLoweredType(Type t) {
773-
return getTypeLowering(t, ResilienceExpansion::Minimal).getLoweredType();
772+
SILType getLoweredType(Type t, ResilienceExpansion forExpansion
773+
= ResilienceExpansion::Minimal) {
774+
return getTypeLowering(t, forExpansion).getLoweredType();
774775
}
775776

776777
// Returns the lowered SIL type for a Swift type.
777-
SILType getLoweredType(AbstractionPattern origType, Type substType) {
778-
return getTypeLowering(origType, substType, ResilienceExpansion::Minimal)
778+
SILType getLoweredType(AbstractionPattern origType, Type substType,
779+
ResilienceExpansion forExpansion =
780+
ResilienceExpansion::Minimal) {
781+
return getTypeLowering(origType, substType, forExpansion)
779782
.getLoweredType();
780783
}
781784

0 commit comments

Comments
 (0)