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

@@ -1585,7 +1585,7 @@ static int doInputCompletenessTest(StringRef SourceFilename) {
//===----------------------------------------------------------------------===//
static ModuleDecl *getModuleByFullName(ASTContext &Context, StringRef ModuleName) {
SmallVector<std::pair<Identifier, SourceLoc>, 4>
SmallVector<Located<Identifier>, 4>
AccessPath;
while (!ModuleName.empty()) {
StringRef SubModuleName;
@@ -1600,8 +1600,7 @@ static ModuleDecl *getModuleByFullName(ASTContext &Context, StringRef ModuleName
}
static ModuleDecl *getModuleByFullName(ASTContext &Context, Identifier ModuleName) {
ModuleDecl *Result = Context.getModule(std::make_pair(ModuleName,
SourceLoc()));
ModuleDecl *Result = Context.getModule({{ModuleName,SourceLoc()}});
if (!Result || Result->failedToLoad())
return nullptr;
return Result;
@@ -2624,7 +2623,7 @@ static int doPrintModuleImports(const CompilerInvocation &InitInvok,
for (auto &import : scratch) {
llvm::outs() << "\t" << import.second->getName();
for (auto accessPathPiece : import.first) {
llvm::outs() << "." << accessPathPiece.first;
llvm::outs() << "." << accessPathPiece.item;
}
if (import.second->isClangModule())