Adapt to llvm.org StringRef API change

This commit is contained in:
Fred Riss
2020-01-31 15:31:50 -08:00
parent 4a4a5fabb0
commit a3afd8b155
102 changed files with 388 additions and 368 deletions

View File

@@ -96,7 +96,7 @@
using namespace swift;
static std::string displayName(StringRef MainExecutablePath) {
std::string Name = llvm::sys::path::stem(MainExecutablePath);
std::string Name = llvm::sys::path::stem(MainExecutablePath).str();
Name += " -frontend";
return Name;
}
@@ -313,21 +313,20 @@ static void computeSwiftModuleTraceInfo(
// this is good enough.
: buffer.str();
traceInfo.push_back({
/*Name=*/
depMod->getName(),
/*Path=*/
realDepPath,
// TODO: There is an edge case which is not handled here.
// When we build a framework using -import-underlying-module, or an
// app/test using -import-objc-header, we should look at the direct
// imports of the bridging modules, and mark those as our direct
// imports.
/*IsImportedDirectly=*/
importedModules.find(depMod) != importedModules.end(),
/*SupportsLibraryEvolution=*/
depMod->isResilient()
});
traceInfo.push_back(
{/*Name=*/
depMod->getName(),
/*Path=*/
realDepPath.str(),
// TODO: There is an edge case which is not handled here.
// When we build a framework using -import-underlying-module, or an
// app/test using -import-objc-header, we should look at the direct
// imports of the bridging modules, and mark those as our direct
// imports.
/*IsImportedDirectly=*/
importedModules.find(depMod) != importedModules.end(),
/*SupportsLibraryEvolution=*/
depMod->isResilient()});
buffer.clear();
continue;
@@ -434,9 +433,7 @@ static bool emitLoadedModuleTraceIfNeeded(ModuleDecl *mainModule,
LoadedModuleTraceFormat trace = {
/*version=*/LoadedModuleTraceFormat::CurrentVersion,
/*name=*/mainModule->getName(),
/*arch=*/ctxt.LangOpts.Target.getArchName(),
swiftModules
};
/*arch=*/ctxt.LangOpts.Target.getArchName().str(), swiftModules};
// raw_fd_ostream is unbuffered, and we may have multiple processes writing,
// so first write to memory and then dump the buffer to the trace file.
@@ -590,7 +587,7 @@ private:
if (!(FixitAll || shouldTakeFixit(Info)))
return;
for (const auto &Fix : Info.FixIts) {
AllEdits.push_back({SM, Fix.getRange(), Fix.getText()});
AllEdits.push_back({SM, Fix.getRange(), Fix.getText().str()});
}
}
@@ -1703,7 +1700,7 @@ static bool dumpAPI(ModuleDecl *Mod, StringRef OutDir) {
SmallString<256> Path = OutDir;
StringRef Filename = SF->getFilename();
path::append(Path, path::filename(Filename));
return Path.str();
return std::string(Path);
};
std::unordered_set<std::string> Filenames;