Skip to content

Commit e4246df

Browse files
authored
---
yaml --- r: 341470 b: refs/heads/rxwei-patch-1 c: a84972b h: refs/heads/master
1 parent 3d0fa0e commit e4246df

File tree

17 files changed

+649
-388
lines changed

17 files changed

+649
-388
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: d0c5b6a4e19bcba893b49563c989d4affafff1df
1018+
refs/heads/rxwei-patch-1: a84972b816d890a1c2d1ba996688feed88730fe5
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
|**[Debian 9.1 (Raspberry Pi)](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/armv7_debian_stretch.json)** | ARMv7 | [![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-debian-9_1)|
1818
|**[Fedora 27](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_fedora_27.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-fedora-27)|
1919
|**[Ubuntu 16.04](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04.json)** | x86_64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04)|
20-
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-4.1-RA-linux-ubuntu-16.04-ppc64le)|
20+
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/ppc64le_ubuntu_16_04.json)** | PPC64LE |[![Build Status](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-5.1-RA-linux-ubuntu-16.04-ppc64le)|
2121
|**[Ubuntu 16.04 ](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/aarch64_ubuntu_16.04.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-aarch64)|
2222
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | ARMv7 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android)|
2323
|**[Android](https://github.com/apple/swift-community-hosted-continuous-integration/blob/master/nodes/x86_64_ubuntu_16_04_LTS_android.json)** | AArch64 |[![Build Status](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/lastCompletedBuild/badge/icon)](https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64)|

branches/rxwei-patch-1/include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ WARNING(implicit_bridging_header_imported_from_module,none,
9191
"is deprecated and will be removed in a later version of Swift",
9292
(StringRef, Identifier))
9393

94-
WARNING(clang_vfs_overlay_is_ignored,none,
95-
"ignoring '-ivfsoverlay' options provided to '-Xcc' in favor of "
96-
"'-vfsoverlay'", ())
97-
9894
#ifndef DIAG_NO_UNDEF
9995
# if defined(DIAG)
10096
# undef DIAG

branches/rxwei-patch-1/include/swift/Basic/SourceManager.h

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@
2323

2424
namespace swift {
2525

26+
static inline llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>
27+
getRealOverlayFileSystem() {
28+
return llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
29+
new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
30+
}
31+
2632
/// This class manages and owns source buffers.
2733
class SourceManager {
2834
llvm::SourceMgr LLVMSourceMgr;
29-
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem;
35+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FileSystem;
3036
unsigned CodeCompletionBufferID = 0U;
3137
unsigned CodeCompletionOffset;
3238

@@ -49,9 +55,9 @@ class SourceManager {
4955
mutable std::pair<const char *, const VirtualFile*> CachedVFile = {nullptr, nullptr};
5056

5157
public:
52-
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS =
53-
llvm::vfs::getRealFileSystem())
54-
: FileSystem(FS) {}
58+
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FS =
59+
getRealOverlayFileSystem())
60+
: FileSystem(FS) {}
5561

5662
llvm::SourceMgr &getLLVMSourceMgr() {
5763
return LLVMSourceMgr;
@@ -60,11 +66,12 @@ class SourceManager {
6066
return LLVMSourceMgr;
6167
}
6268

63-
void setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
69+
void
70+
setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> FS) {
6471
FileSystem = FS;
6572
}
6673

67-
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> getFileSystem() {
74+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> getFileSystem() {
6875
return FileSystem;
6976
}
7077

@@ -254,4 +261,3 @@ class SourceManager {
254261
} // end namespace swift
255262

256263
#endif // SWIFT_BASIC_SOURCEMANAGER_H
257-

branches/rxwei-patch-1/lib/AST/Type.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,16 +1233,23 @@ CanType TypeBase::getCanonicalType(GenericSignature *sig) {
12331233
}
12341234

12351235
TypeBase *TypeBase::reconstituteSugar(bool Recursive) {
1236-
auto Func = [](Type Ty) -> Type {
1236+
auto Func = [Recursive](Type Ty) -> Type {
12371237
if (auto boundGeneric = dyn_cast<BoundGenericType>(Ty.getPointer())) {
1238+
1239+
auto getGenericArg = [&](unsigned i) -> Type {
1240+
auto arg = boundGeneric->getGenericArgs()[i];
1241+
if (Recursive)
1242+
arg = arg->reconstituteSugar(Recursive);
1243+
return arg;
1244+
};
1245+
12381246
auto &ctx = boundGeneric->getASTContext();
12391247
if (boundGeneric->getDecl() == ctx.getArrayDecl())
1240-
return ArraySliceType::get(boundGeneric->getGenericArgs()[0]);
1248+
return ArraySliceType::get(getGenericArg(0));
12411249
if (boundGeneric->getDecl() == ctx.getDictionaryDecl())
1242-
return DictionaryType::get(boundGeneric->getGenericArgs()[0],
1243-
boundGeneric->getGenericArgs()[1]);
1250+
return DictionaryType::get(getGenericArg(0), getGenericArg(1));
12441251
if (boundGeneric->getDecl() == ctx.getOptionalDecl())
1245-
return OptionalType::get(boundGeneric->getGenericArgs()[0]);
1252+
return OptionalType::get(getGenericArg(0));
12461253
}
12471254
return Ty;
12481255
};

branches/rxwei-patch-1/lib/ClangImporter/ClangImporter.cpp

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,14 +1012,35 @@ ClangImporter::create(ASTContext &ctx,
10121012

10131013
// Set up the file manager.
10141014
{
1015-
if (!ctx.SearchPathOpts.VFSOverlayFiles.empty()) {
1016-
// If the clang instance has overlays it means the user has provided
1017-
// -ivfsoverlay options and swift -vfsoverlay options. We're going to
1018-
// clobber their file system with our own, so warn about it.
1019-
if (!instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
1020-
ctx.Diags.diagnose(SourceLoc(), diag::clang_vfs_overlay_is_ignored);
1021-
}
1015+
if (instance.getHeaderSearchOpts().VFSOverlayFiles.empty()) {
10221016
instance.setVirtualFileSystem(ctx.SourceMgr.getFileSystem());
1017+
} else {
1018+
// Initialize the clang VFS from its compiler invocation.
1019+
instance.createFileManager();
1020+
1021+
// Create a new overlay file system for the clang importer with the clang
1022+
// VFS as its root.
1023+
auto ClangImporterFS =
1024+
llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
1025+
new llvm::vfs::OverlayFileSystem(
1026+
&instance.getVirtualFileSystem()));
1027+
1028+
auto SwiftFS = ctx.SourceMgr.getFileSystem();
1029+
auto it = SwiftFS->overlays_rbegin();
1030+
auto end = SwiftFS->overlays_rend();
1031+
1032+
// The Swift file system is an overlay file system with the real file
1033+
// system as its root. Skip the root so we query the other overlays
1034+
// before falling back to the real file system.
1035+
it++;
1036+
1037+
// Add all remaining Swift overlay file systems to the new file system.
1038+
while (it != end) {
1039+
ClangImporterFS->pushOverlay(*it);
1040+
it++;
1041+
}
1042+
1043+
instance.setVirtualFileSystem(ClangImporterFS);
10231044
}
10241045
instance.createFileManager();
10251046
}

branches/rxwei-patch-1/lib/Frontend/Frontend.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ static bool loadAndValidateVFSOverlay(
235235
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &BaseFS,
236236
const llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> &OverlayFS,
237237
DiagnosticEngine &Diag) {
238-
// FIXME: It should be possible to allow chained lookup of later VFS overlays
239-
// through the mapping defined by earlier overlays.
240-
// See rdar://problem/39440687
241238
auto Buffer = BaseFS->getBufferForFile(File);
242239
if (!Buffer) {
243240
Diag.diagnose(SourceLoc(), diag::cannot_open_file, File,
@@ -264,14 +261,7 @@ bool CompilerInstance::setUpVirtualFileSystemOverlays() {
264261
hadAnyFailure |=
265262
loadAndValidateVFSOverlay(File, BaseFS, OverlayFS, Diagnostics);
266263
}
267-
268-
// If we successfully loaded all the overlays, let the source manager and
269-
// diagnostic engine take advantage of the overlay file system.
270-
if (!hadAnyFailure &&
271-
(OverlayFS->overlays_begin() != OverlayFS->overlays_end())) {
272-
SourceMgr.setFileSystem(OverlayFS);
273-
}
274-
264+
SourceMgr.setFileSystem(OverlayFS);
275265
return hadAnyFailure;
276266
}
277267

branches/rxwei-patch-1/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static Optional<StringRef> getRelativeDepPath(StringRef DepPath,
273273
/// output path.
274274
/// \note Needs to be in the swift namespace so CompilerInvocation can see it.
275275
class swift::ParseableInterfaceBuilder {
276-
llvm::vfs::FileSystem &fs;
276+
llvm::vfs::OverlayFileSystem &fs;
277277
DiagnosticEngine &diags;
278278
const StringRef interfacePath;
279279
const StringRef moduleName;
@@ -765,7 +765,7 @@ class ParseableInterfaceModuleLoaderImpl {
765765
using AccessPathElem = std::pair<Identifier, SourceLoc>;
766766
friend class swift::ParseableInterfaceModuleLoader;
767767
ASTContext &ctx;
768-
llvm::vfs::FileSystem &fs;
768+
llvm::vfs::OverlayFileSystem &fs;
769769
DiagnosticEngine &diags;
770770
ModuleRebuildInfo rebuildInfo;
771771
const StringRef modulePath;

0 commit comments

Comments
 (0)