SR-11889: Using Located<T> instead of std::pair<SourceLoc, T>

This commit is contained in:
Kita, Maksim
2019-12-08 22:51:48 +03:00
parent 06014e6226
commit b7cb3b67bf
38 changed files with 209 additions and 171 deletions

View File

@@ -50,7 +50,7 @@ protected:
void collectVisibleTopLevelModuleNamesImpl(SmallVectorImpl<Identifier> &names,
StringRef extension) const;
using AccessPathElem = std::pair<Identifier, SourceLoc>;
using AccessPathElem = Located<Identifier>;
bool findModule(AccessPathElem moduleID,
SmallVectorImpl<char> *moduleInterfacePath,
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
@@ -140,7 +140,7 @@ public:
///
/// Note that even if this check succeeds, errors may still occur if the
/// module is loaded in full.
virtual bool canImportModule(std::pair<Identifier, SourceLoc> named) override;
virtual bool canImportModule(Located<Identifier> named) override;
/// Import a module with the given module path.
///
@@ -153,7 +153,7 @@ public:
/// emits a diagnostic and returns a FailedImportModule object.
virtual ModuleDecl *
loadModule(SourceLoc importLoc,
ArrayRef<std::pair<Identifier, SourceLoc>> path) override;
ArrayRef<Located<Identifier>> path) override;
virtual void loadExtensions(NominalTypeDecl *nominal,
@@ -240,10 +240,10 @@ class MemoryBufferSerializedModuleLoader : public SerializedModuleLoaderBase {
public:
virtual ~MemoryBufferSerializedModuleLoader();
bool canImportModule(std::pair<Identifier, SourceLoc> named) override;
bool canImportModule(Located<Identifier> named) override;
ModuleDecl *
loadModule(SourceLoc importLoc,
ArrayRef<std::pair<Identifier, SourceLoc>> path) override;
ArrayRef<Located<Identifier>> path) override;
/// Register a memory buffer that contains the serialized module for the given
/// access path. This API is intended to be used by LLDB to add swiftmodules