Adapt to llvm.org StringRef API change

This commit is contained in:
Fred Riss
2020-01-31 15:31:50 -08:00
committed by Michael Forster
parent 710799dd09
commit 259d78a350
99 changed files with 346 additions and 327 deletions

View File

@@ -461,7 +461,7 @@ static FrontendInputsAndOutputs resolveSymbolicLinksInInputs(
llvm::SmallString<64> Err;
llvm::raw_svector_ostream OS(Err);
OS << "'" << PrimaryFile << "' is not part of the input files";
Error = OS.str();
Error = std::string(OS.str());
return replacementInputsAndOutputs;
}
@@ -501,7 +501,7 @@ bool SwiftASTManager::initCompilerInvocation(
Diags.removeConsumer(DiagConsumer);
if (HadError) {
Error = ErrOS.str();
Error = std::string(ErrOS.str());
return true;
}
@@ -683,7 +683,7 @@ static FileContent getFileContentFromSnap(ImmutableTextSnapshotRef Snap,
bool IsPrimary, StringRef FilePath) {
auto Buf = llvm::MemoryBuffer::getMemBufferCopy(
Snap->getBuffer()->getText(), FilePath);
return FileContent(Snap, FilePath, std::move(Buf), IsPrimary,
return FileContent(Snap, FilePath.str(), std::move(Buf), IsPrimary,
Snap->getStamp());
}
@@ -699,8 +699,8 @@ FileContent SwiftASTManager::Implementation::getFileContent(
// FIXME: Is there a way to get timestamp and buffer for a file atomically ?
auto Stamp = getBufferStamp(FilePath, FileSystem);
auto Buffer = getMemoryBuffer(FilePath, FileSystem, Error);
return FileContent(nullptr, UnresolvedPath, std::move(Buffer), IsPrimary,
Stamp);
return FileContent(nullptr, UnresolvedPath.str(), std::move(Buffer),
IsPrimary, Stamp);
}
BufferStamp SwiftASTManager::Implementation::getBufferStamp(
@@ -903,7 +903,7 @@ static void collectModuleDependencies(ModuleDecl *TopMod,
// getModuleFilename() (by returning an empty path). Note that such modules
// may be heterogeneous.
{
std::string Path = Mod->getModuleFilename();
std::string Path = Mod->getModuleFilename().str();
if (Path.empty() || Path == TopMod->getModuleFilename())
continue; // this is a submodule.
Filenames.push_back(std::move(Path));