Skip to content

Commit adcdc39

Browse files
compnerdbob-wilson
authored andcommitted
swift: update for LLVM SVN r344140
Update swift's usage of clang::vfs which has been hoisted into LLVM.
1 parent fb30547 commit adcdc39

File tree

7 files changed

+25
-24
lines changed

7 files changed

+25
-24
lines changed

include/swift/Basic/FileSystem.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace llvm {
2323
class Twine;
2424
}
2525

26-
namespace clang {
26+
namespace llvm {
2727
namespace vfs {
2828
class FileSystem;
2929
}
@@ -58,7 +58,7 @@ namespace swift {
5858

5959
namespace vfs {
6060
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
61-
getFileOrSTDIN(clang::vfs::FileSystem &FS,
61+
getFileOrSTDIN(llvm::vfs::FileSystem &FS,
6262
const llvm::Twine &Name, int64_t FileSize = -1,
6363
bool RequiresNullTerminator = true, bool IsVolatile = false);
6464
} // end namespace vfs

include/swift/Basic/SourceManager.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace swift {
2626
/// This class manages and owns source buffers.
2727
class SourceManager {
2828
llvm::SourceMgr LLVMSourceMgr;
29-
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FileSystem;
29+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem;
3030
unsigned CodeCompletionBufferID = 0U;
3131
unsigned CodeCompletionOffset;
3232

@@ -37,7 +37,7 @@ class SourceManager {
3737
///
3838
/// This is as much a hack to prolong the lifetime of status objects as it is
3939
/// to speed up stats.
40-
mutable llvm::DenseMap<StringRef, clang::vfs::Status> StatusCache;
40+
mutable llvm::DenseMap<StringRef, llvm::vfs::Status> StatusCache;
4141

4242
// \c #sourceLocation directive handling.
4343
struct VirtualFile {
@@ -49,8 +49,8 @@ class SourceManager {
4949
mutable std::pair<const char *, const VirtualFile*> CachedVFile = {nullptr, nullptr};
5050

5151
public:
52-
SourceManager(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FS =
53-
clang::vfs::getRealFileSystem())
52+
SourceManager(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS =
53+
llvm::vfs::getRealFileSystem())
5454
: FileSystem(FS) {}
5555

5656
llvm::SourceMgr &getLLVMSourceMgr() {
@@ -60,11 +60,11 @@ class SourceManager {
6060
return LLVMSourceMgr;
6161
}
6262

63-
void setFileSystem(llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> FS) {
63+
void setFileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS) {
6464
FileSystem = FS;
6565
}
6666

67-
llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> getFileSystem() {
67+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> getFileSystem() {
6868
return FileSystem;
6969
}
7070

include/swift/Frontend/Frontend.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class CompilerInstance {
430430

431431
DiagnosticEngine &getDiags() { return Diagnostics; }
432432

433-
clang::vfs::FileSystem &getFileSystem() { return *SourceMgr.getFileSystem(); }
433+
llvm::vfs::FileSystem &getFileSystem() { return *SourceMgr.getFileSystem(); }
434434

435435
ASTContext &getASTContext() {
436436
return *Context;

lib/Basic/FileSystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "llvm/Support/Path.h"
2121
#include "llvm/Support/Process.h"
2222
#include "llvm/Support/Signals.h"
23+
#include "llvm/Support/VirtualFileSystem.h"
2324

2425
using namespace swift;
2526

@@ -223,7 +224,7 @@ std::error_code swift::moveFileIfDifferent(const llvm::Twine &source,
223224
}
224225

225226
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
226-
swift::vfs::getFileOrSTDIN(clang::vfs::FileSystem &FS,
227+
swift::vfs::getFileOrSTDIN(llvm::vfs::FileSystem &FS,
227228
const llvm::Twine &Filename,
228229
int64_t FileSize,
229230
bool RequiresNullTerminator,

lib/Frontend/Frontend.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ bool CompilerInstance::setup(const CompilerInvocation &Invok) {
213213

214214
static bool loadAndValidateVFSOverlay(
215215
const std::string &File,
216-
const llvm::IntrusiveRefCntPtr<clang::vfs::FileSystem> &BaseFS,
217-
const llvm::IntrusiveRefCntPtr<clang::vfs::OverlayFileSystem> &OverlayFS,
216+
const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &BaseFS,
217+
const llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> &OverlayFS,
218218
DiagnosticEngine &Diag) {
219219
// FIXME: It should be possible to allow chained lookup of later VFS overlays
220220
// through the mapping defined by earlier overlays.
@@ -226,7 +226,7 @@ static bool loadAndValidateVFSOverlay(
226226
return true;
227227
}
228228

229-
auto VFS = clang::vfs::getVFSFromYAML(std::move(Buffer.get()),
229+
auto VFS = llvm::vfs::getVFSFromYAML(std::move(Buffer.get()),
230230
nullptr, File);
231231
if (!VFS) {
232232
Diag.diagnose(SourceLoc(), diag::invalid_vfs_overlay_file, File);
@@ -237,9 +237,9 @@ static bool loadAndValidateVFSOverlay(
237237
}
238238

239239
bool CompilerInstance::setUpVirtualFileSystemOverlays() {
240-
auto BaseFS = clang::vfs::getRealFileSystem();
241-
auto OverlayFS = llvm::IntrusiveRefCntPtr<clang::vfs::OverlayFileSystem>(
242-
new clang::vfs::OverlayFileSystem(BaseFS));
240+
auto BaseFS = llvm::vfs::getRealFileSystem();
241+
auto OverlayFS = llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem>(
242+
new llvm::vfs::OverlayFileSystem(BaseFS));
243243
bool hadAnyFailure = false;
244244
for (const auto &File : Invocation.getSearchPathOptions().VFSOverlayFiles) {
245245
hadAnyFailure |=

lib/Frontend/ParseableInterfaceSupport.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static swift::version::Version InterfaceFormatVersion({1, 0});
5050

5151
static bool
5252
extractSwiftInterfaceVersionAndArgs(DiagnosticEngine &Diags, SourceLoc DiagLoc,
53-
clang::vfs::FileSystem &FS,
53+
llvm::vfs::FileSystem &FS,
5454
StringRef SwiftInterfacePathIn,
5555
swift::version::Version &Vers,
5656
llvm::StringSaver &SubArgSaver,
@@ -97,8 +97,8 @@ getBufferOfDependency(clang::vfs::FileSystem &FS,
9797
return std::move(DepBuf.get());
9898
}
9999

100-
static Optional<clang::vfs::Status>
101-
getStatusOfDependency(clang::vfs::FileSystem &FS,
100+
static Optional<llvm::vfs::Status>
101+
getStatusOfDependency(llvm::vfs::FileSystem &FS,
102102
StringRef ModulePath, StringRef DepPath,
103103
DiagnosticEngine &Diags, SourceLoc DiagLoc) {
104104
auto Status = FS.status(DepPath);
@@ -215,7 +215,7 @@ void ParseableInterfaceModuleLoader::configureSubInvocationInputsAndOutputs(
215215

216216
// Checks that a dependency read from the cached module is up to date compared
217217
// to the interface file it represents.
218-
static bool dependencyIsUpToDate(clang::vfs::FileSystem &FS, FileDependency In,
218+
static bool dependencyIsUpToDate(llvm::vfs::FileSystem &FS, FileDependency In,
219219
StringRef ModulePath, DiagnosticEngine &Diags,
220220
SourceLoc DiagLoc) {
221221
auto Status = getStatusOfDependency(FS, ModulePath, In.Path, Diags, DiagLoc);
@@ -227,7 +227,7 @@ static bool dependencyIsUpToDate(clang::vfs::FileSystem &FS, FileDependency In,
227227
// Check that the output .swiftmodule file is at least as new as all the
228228
// dependencies it read when it was built last time.
229229
static bool
230-
swiftModuleIsUpToDate(clang::vfs::FileSystem &FS,
230+
swiftModuleIsUpToDate(llvm::vfs::FileSystem &FS,
231231
std::pair<Identifier, SourceLoc> ModuleID,
232232
StringRef OutPath,
233233
DiagnosticEngine &Diags,
@@ -332,7 +332,7 @@ collectDepsForSerialization(clang::vfs::FileSystem &FS,
332332
}
333333

334334
bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface(
335-
clang::vfs::FileSystem &FS, DiagnosticEngine &Diags, SourceLoc DiagLoc,
335+
llvm::vfs::FileSystem &FS, DiagnosticEngine &Diags, SourceLoc DiagLoc,
336336
CompilerInvocation &SubInvocation, StringRef InPath, StringRef OutPath,
337337
StringRef ModuleCachePath, DependencyTracker *OuterTracker,
338338
bool ShouldSerializeDeps) {
@@ -457,7 +457,7 @@ bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface(
457457
return !RunSuccess || SubError;
458458
}
459459

460-
static bool serializedASTLooksValidOrCannotBeRead(clang::vfs::FileSystem &FS,
460+
static bool serializedASTLooksValidOrCannotBeRead(llvm::vfs::FileSystem &FS,
461461
StringRef ModPath) {
462462
auto ModBuf = FS.getBufferForFile(ModPath, /*FileSize=*/-1,
463463
/*RequiresNullTerminator=*/false);

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ std::error_code SerializedModuleLoaderBase::openModuleFiles(
5050
(!ModuleBuffer && !ModuleDocBuffer)) &&
5151
"Module and Module Doc buffer must both be initialized or NULL");
5252

53-
clang::vfs::FileSystem &FS = *Ctx.SourceMgr.getFileSystem();
53+
llvm::vfs::FileSystem &FS = *Ctx.SourceMgr.getFileSystem();
5454

5555
// Try to open the module file first. If we fail, don't even look for the
5656
// module documentation file.

0 commit comments

Comments
 (0)