Skip to content

Commit 2e5091c

Browse files
authored
---
yaml --- r: 278491 b: refs/heads/swift-5.1-old-llvm-branch c: 22bcbe5 h: refs/heads/master i: 278489: b422094 278487: 377111a
1 parent b272741 commit 2e5091c

30 files changed

+2409
-814
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: 4acffab1738f6035af2deb3f6d9c3f164a9c96eb
1244+
refs/heads/swift-5.1-old-llvm-branch: 22bcbe510b17fff056ac4bb87b5f89fc3830ff22
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/Serialization/SerializedModuleLoader.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class SerializedModuleLoaderBase : public ModuleLoader {
6868
/// to list the architectures that \e are present.
6969
///
7070
/// \returns true if an error diagnostic was emitted
71-
virtual bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
72-
StringRef moduleName,
73-
StringRef archName,
74-
StringRef directoryPath) {
71+
virtual bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
72+
StringRef moduleName,
73+
StringRef archName,
74+
StringRef directoryPath) {
7575
return false;
7676
}
7777

@@ -139,10 +139,10 @@ class SerializedModuleLoader : public SerializedModuleLoaderBase {
139139
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
140140
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
141141

142-
bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
143-
StringRef moduleName,
144-
StringRef archName,
145-
StringRef directoryPath) override;
142+
bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
143+
StringRef moduleName,
144+
StringRef archName,
145+
StringRef directoryPath) override;
146146

147147
public:
148148
virtual ~SerializedModuleLoader();

branches/swift-5.1-old-llvm-branch/lib/AST/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ add_swift_host_library(swiftAST STATIC
9595
TypeRefinementContext.cpp
9696
TypeRepr.cpp
9797
TypeWalker.cpp
98+
UnqualifiedLookup.cpp
9899
USRGeneration.cpp
99100

100101
INTERFACE_LINK_LIBRARIES

0 commit comments

Comments
 (0)