mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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 {
|
||||
|
||||
struct MemoryBufferInfo {
|
||||
MemoryBufferInfo(std::unique_ptr<llvm::MemoryBuffer> &&buffer,
|
||||
llvm::VersionTuple userVersion)
|
||||
: buffer(std::move(buffer)), userVersion(userVersion) {}
|
||||
std::unique_ptr<llvm::MemoryBuffer> buffer;
|
||||
llvm::VersionTuple userVersion;
|
||||
};
|
||||
@@ -363,11 +366,16 @@ public:
|
||||
/// discovered in the __swift_ast section of a Mach-O file (or the .swift_ast
|
||||
/// 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.
|
||||
void registerMemoryBuffer(StringRef importPath,
|
||||
bool registerMemoryBuffer(StringRef importPath,
|
||||
std::unique_ptr<llvm::MemoryBuffer> input,
|
||||
llvm::VersionTuple version) {
|
||||
MemoryBuffers[importPath] = {std::move(input), version};
|
||||
return MemoryBuffers
|
||||
.insert({importPath, MemoryBufferInfo(std::move(input), version)})
|
||||
.second;
|
||||
}
|
||||
|
||||
void collectVisibleTopLevelModuleNames(
|
||||
|
||||
Reference in New Issue
Block a user