mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Define the semantics of registerMemoryBuffer() when insterting duplicates
to let the first module win. This functionality is tested in LLDB.
This commit is contained in:
@@ -315,6 +315,9 @@ public:
|
|||||||
class MemoryBufferSerializedModuleLoader : public SerializedModuleLoaderBase {
|
class MemoryBufferSerializedModuleLoader : public SerializedModuleLoaderBase {
|
||||||
|
|
||||||
struct MemoryBufferInfo {
|
struct MemoryBufferInfo {
|
||||||
|
MemoryBufferInfo(std::unique_ptr<llvm::MemoryBuffer> &&buffer,
|
||||||
|
llvm::VersionTuple userVersion)
|
||||||
|
: buffer(std::move(buffer)), userVersion(userVersion) {}
|
||||||
std::unique_ptr<llvm::MemoryBuffer> buffer;
|
std::unique_ptr<llvm::MemoryBuffer> buffer;
|
||||||
llvm::VersionTuple userVersion;
|
llvm::VersionTuple userVersion;
|
||||||
};
|
};
|
||||||
@@ -363,11 +366,16 @@ public:
|
|||||||
/// discovered in the __swift_ast section of a Mach-O file (or the .swift_ast
|
/// discovered in the __swift_ast section of a Mach-O file (or the .swift_ast
|
||||||
/// section of an ELF file) to the search path.
|
/// section of an ELF file) to the search path.
|
||||||
///
|
///
|
||||||
|
/// If a module is inserted twice, the first one wins, and the return value is
|
||||||
|
/// false.
|
||||||
|
///
|
||||||
/// FIXME: make this an actual import *path* once submodules are designed.
|
/// FIXME: make this an actual import *path* once submodules are designed.
|
||||||
void registerMemoryBuffer(StringRef importPath,
|
bool registerMemoryBuffer(StringRef importPath,
|
||||||
std::unique_ptr<llvm::MemoryBuffer> input,
|
std::unique_ptr<llvm::MemoryBuffer> input,
|
||||||
llvm::VersionTuple version) {
|
llvm::VersionTuple version) {
|
||||||
MemoryBuffers[importPath] = {std::move(input), version};
|
return MemoryBuffers
|
||||||
|
.insert({importPath, MemoryBufferInfo(std::move(input), version)})
|
||||||
|
.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void collectVisibleTopLevelModuleNames(
|
void collectVisibleTopLevelModuleNames(
|
||||||
|
|||||||
Reference in New Issue
Block a user