mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ParseableInterfaces] Handle swiftdoc files correctly
The previous 'openModuleFiles' interface in SerializedModuleLoaderBase still assumed that swiftmodule files and swiftdoc files would be found next to each other, but that's not true anymore with swiftinterfaces-built-to-modules. Give up on this assumption (and on the minor optimization of passing down a scratch buffer) and split out the interface into the customization point 'findModuleFilesInDirectory' and the implementation 'openModuleFiles'. The latter now takes two full paths: one for the swiftmodule, one for the swiftdoc.
This commit is contained in:
@@ -51,12 +51,17 @@ protected:
|
||||
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer,
|
||||
bool &isFramework);
|
||||
|
||||
virtual std::error_code
|
||||
openModuleFiles(AccessPathElem ModuleID, StringRef DirName,
|
||||
StringRef ModuleFilename, StringRef ModuleDocFilename,
|
||||
virtual std::error_code findModuleFilesInDirectory(
|
||||
AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename,
|
||||
StringRef ModuleDocFilename,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) = 0;
|
||||
|
||||
std::error_code
|
||||
openModuleFiles(AccessPathElem ModuleID,
|
||||
StringRef ModulePath, StringRef ModuleDocPath,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
|
||||
llvm::SmallVectorImpl<char> &Scratch);
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer);
|
||||
|
||||
/// If the module loader subclass knows that all options have been tried for
|
||||
/// loading an architecture-specific file out of a swiftmodule bundle, try
|
||||
@@ -128,12 +133,11 @@ class SerializedModuleLoader : public SerializedModuleLoaderBase {
|
||||
: SerializedModuleLoaderBase(ctx, tracker, loadMode)
|
||||
{}
|
||||
|
||||
std::error_code
|
||||
openModuleFiles(AccessPathElem ModuleID, StringRef DirName,
|
||||
StringRef ModuleFilename, StringRef ModuleDocFilename,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
|
||||
llvm::SmallVectorImpl<char> &Scratch) override;
|
||||
std::error_code findModuleFilesInDirectory(
|
||||
AccessPathElem ModuleID, StringRef DirPath, StringRef ModuleFilename,
|
||||
StringRef ModuleDocFilename,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
|
||||
|
||||
bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
|
||||
StringRef moduleName,
|
||||
|
||||
Reference in New Issue
Block a user