Skip to content

Commit 377111a

Browse files
authored
---
yaml --- r: 278487 b: refs/heads/swift-5.1-old-llvm-branch c: bd8890a h: refs/heads/master i: 278485: 21978a5 278483: 451cc0a 278479: b7caa41
1 parent 3ad7b51 commit 377111a

File tree

61 files changed

+2608
-938
lines changed

Some content is hidden

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

61 files changed

+2608
-938
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: b36c646914248f08a45b735239ba9f57c4903bd7
1244+
refs/heads/swift-5.1-old-llvm-branch: bd8890aca5c64dbc549430fd835fd6ca562d37cb
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/cmake/modules/SwiftSharedCMakeConfig.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,7 @@ endmacro()
213213
# The product name, e.g. Swift or SourceKit. Used as prefix for some
214214
# cmake variables.
215215
macro(swift_common_unified_build_config product)
216-
set(PATH_TO_LLVM_SOURCE "${CMAKE_SOURCE_DIR}")
217-
set(PATH_TO_LLVM_BUILD "${CMAKE_BINARY_DIR}")
218216
set(${product}_PATH_TO_CLANG_BUILD "${CMAKE_BINARY_DIR}")
219-
set(PATH_TO_CLANG_BUILD "${CMAKE_BINARY_DIR}")
220217
set(CLANG_MAIN_INCLUDE_DIR "${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/include")
221218
set(CLANG_BUILD_INCLUDE_DIR "${CMAKE_BINARY_DIR}/tools/clang/include")
222219
set(${product}_NATIVE_LLVM_TOOLS_PATH "${CMAKE_BINARY_DIR}/bin")

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/Reflection/ReflectionContext.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ template <> struct ELFTraits<llvm::ELF::ELFCLASS32> {
6262
using Section = const struct llvm::ELF::Elf32_Shdr;
6363
using Offset = llvm::ELF::Elf32_Off;
6464
using Size = llvm::ELF::Elf32_Word;
65-
using Address = llvm::ELF::Elf32_Addr;
6665
static constexpr unsigned char ELFClass = llvm::ELF::ELFCLASS32;
6766
};
6867

@@ -71,7 +70,6 @@ template <> struct ELFTraits<llvm::ELF::ELFCLASS64> {
7170
using Section = const struct llvm::ELF::Elf64_Shdr;
7271
using Offset = llvm::ELF::Elf64_Off;
7372
using Size = llvm::ELF::Elf64_Xword;
74-
using Address = llvm::ELF::Elf64_Addr;
7573
static constexpr unsigned char ELFClass = llvm::ELF::ELFCLASS64;
7674
};
7775

@@ -204,7 +202,7 @@ class ReflectionContext
204202
RangeEnd - RangeStart);
205203

206204
auto findMachOSectionByName = [&](std::string Name)
207-
-> std::pair<std::pair<const char *, const char *>, uint32_t> {
205+
-> std::pair<std::pair<const char *, const char *>, uint64_t> {
208206
for (unsigned I = 0; I < NumSect; ++I) {
209207
auto S = reinterpret_cast<typename T::Section *>(
210208
SectionsBuf + (I * sizeof(typename T::Section)));
@@ -235,8 +233,8 @@ class ReflectionContext
235233
ReflStrMdSec.first.first == nullptr)
236234
return false;
237235

238-
auto LocalStartAddress = reinterpret_cast<uintptr_t>(SectBuf.get());
239-
auto RemoteStartAddress = static_cast<uintptr_t>(RangeStart);
236+
auto LocalStartAddress = reinterpret_cast<uint64_t>(SectBuf.get());
237+
auto RemoteStartAddress = static_cast<uint64_t>(RangeStart);
240238

241239
ReflectionInfo info = {
242240
{{FieldMdSec.first.first, FieldMdSec.first.second}, 0},
@@ -428,7 +426,7 @@ class ReflectionContext
428426
auto StrTab = reinterpret_cast<const char *>(StrTabBuf.get());
429427

430428
auto findELFSectionByName = [&](std::string Name)
431-
-> std::pair<std::pair<const char *, const char *>, typename T::Address> {
429+
-> std::pair<std::pair<const char *, const char *>, uint64_t> {
432430
// Now for all the sections, find their name.
433431
for (const typename T::Section *Hdr : SecHdrVec) {
434432
uint32_t Offset = Hdr->sh_name;
@@ -463,9 +461,9 @@ class ReflectionContext
463461
ReflStrMdSec.first.first == nullptr)
464462
return false;
465463

466-
auto LocalStartAddress = reinterpret_cast<uintptr_t>(Buf.get());
464+
auto LocalStartAddress = reinterpret_cast<uint64_t>(Buf.get());
467465
auto RemoteStartAddress =
468-
static_cast<uintptr_t>(ImageStart.getAddressData());
466+
static_cast<uint64_t>(ImageStart.getAddressData());
469467

470468
ReflectionInfo info = {
471469
{{FieldMdSec.first.first, FieldMdSec.first.second}, FieldMdSec.second},

branches/swift-5.1-old-llvm-branch/include/swift/Reflection/TypeRefBuilder.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,36 +82,36 @@ using GenericSection = ReflectionSection<const void *>;
8282
struct ReflectionInfo {
8383
struct {
8484
FieldSection Metadata;
85-
uintptr_t SectionOffset;
85+
uint64_t SectionOffset;
8686
} Field;
8787

8888
struct {
8989
AssociatedTypeSection Metadata;
90-
uintptr_t SectionOffset;
90+
uint64_t SectionOffset;
9191
} AssociatedType;
9292

9393
struct {
9494
BuiltinTypeSection Metadata;
95-
uintptr_t SectionOffset;
95+
uint64_t SectionOffset;
9696
} Builtin;
9797

9898
struct {
9999
CaptureSection Metadata;
100-
uintptr_t SectionOffset;
100+
uint64_t SectionOffset;
101101
} Capture;
102102

103103
struct {
104104
GenericSection Metadata;
105-
uintptr_t SectionOffset;
105+
uint64_t SectionOffset;
106106
} TypeReference;
107107

108108
struct {
109109
GenericSection Metadata;
110-
uintptr_t SectionOffset;
110+
uint64_t SectionOffset;
111111
} ReflectionString;
112112

113-
uintptr_t LocalStartAddress;
114-
uintptr_t RemoteStartAddress;
113+
uint64_t LocalStartAddress;
114+
uint64_t RemoteStartAddress;
115115
};
116116

117117
struct ClosureContextInfo {
@@ -506,11 +506,11 @@ class TypeRefBuilder {
506506

507507
/// Get the raw capture descriptor for a remote capture descriptor
508508
/// address.
509-
const CaptureDescriptor *getCaptureDescriptor(uintptr_t RemoteAddress);
509+
const CaptureDescriptor *getCaptureDescriptor(uint64_t RemoteAddress);
510510

511511
/// Get the unsubstituted capture types for a closure context.
512512
ClosureContextInfo getClosureContextInfo(const CaptureDescriptor &CD,
513-
uintptr_t Offset);
513+
uint64_t Offset);
514514

515515
///
516516
/// Dumping typerefs, field declarations, associated types

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

Lines changed: 13 additions & 4 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),
@@ -2472,8 +2476,13 @@ class MetadataReader {
24722476
TaggedPointerExtendedClasses =
24732477
TaggedPointerExtendedClassesAddr.getAddressData();
24742478

2475-
tryFindAndReadSymbol(TaggedPointerObfuscator,
2476-
"objc_debug_taggedpointer_obfuscator");
2479+
// The tagged pointer obfuscator is not present on older OSes, in
2480+
// which case we can treat it as zero.
2481+
TaggedPointerObfuscator = 0;
2482+
auto TaggedPointerObfuscatorAddr = Reader->getSymbolAddress(
2483+
"objc_debug_taggedpointer_obfuscator");
2484+
if (TaggedPointerObfuscatorAddr)
2485+
tryReadSymbol(TaggedPointerObfuscatorAddr, TaggedPointerObfuscator);
24772486

24782487
# undef tryFindSymbol
24792488
# undef tryReadSymbol

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/include/swift/SwiftRemoteMirror/SwiftRemoteMirrorTypes.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
extern "C" {
2525
#endif
2626

27-
typedef uintptr_t swift_typeref_t;
27+
typedef uint64_t swift_typeref_t;
2828

2929
/// Represents one of the Swift reflection sections of an image.
3030
typedef struct swift_reflection_section {
@@ -37,37 +37,37 @@ typedef struct swift_reflection_section {
3737
typedef struct swift_reflection_info {
3838
struct {
3939
swift_reflection_section_t section;
40-
uintptr_t offset;
40+
uint64_t offset;
4141
} field;
4242

4343
struct {
4444
swift_reflection_section_t section;
45-
uintptr_t offset;
45+
uint64_t offset;
4646
} associated_types;
4747

4848
struct {
4949
swift_reflection_section_t section;
50-
uintptr_t offset;
50+
uint64_t offset;
5151
} builtin_types;
5252

5353
struct {
5454
swift_reflection_section_t section;
55-
uintptr_t offset;
55+
uint64_t offset;
5656
} capture;
5757

5858
struct {
5959
swift_reflection_section_t section;
60-
uintptr_t offset;
60+
uint64_t offset;
6161
} type_references;
6262

6363
struct {
6464
swift_reflection_section_t section;
65-
uintptr_t offset;
65+
uint64_t offset;
6666
} reflection_strings;
6767

6868
// Start address in local and remote address spaces.
69-
uintptr_t LocalStartAddress;
70-
uintptr_t RemoteStartAddress;
69+
uint64_t LocalStartAddress;
70+
uint64_t RemoteStartAddress;
7171
} swift_reflection_info_t;
7272

7373
/// The layout kind of a Swift type.

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)