1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

Make writeToResolutionFile a static helper.

llvm-svn: 279859
This commit is contained in:
Rafael Espindola 2016-08-26 20:19:35 +00:00
parent 160e4d9563
commit 26c1b18156
2 changed files with 10 additions and 12 deletions

View File

@ -368,8 +368,6 @@ private:
// Global mapping from mangled symbol names to resolutions.
StringMap<GlobalResolution> GlobalResolutions;
void writeToResolutionFile(InputFile *Input, ArrayRef<SymbolResolution> Res);
void addSymbolToGlobalRes(object::IRObjectFile *Obj,
SmallPtrSet<GlobalValue *, 8> &Used,
const InputFile::Symbol &Sym, SymbolResolution Res,

View File

@ -257,23 +257,23 @@ void LTO::addSymbolToGlobalRes(IRObjectFile *Obj,
GlobalRes.Partition = Partition;
}
void LTO::writeToResolutionFile(InputFile *Input,
ArrayRef<SymbolResolution> Res) {
StringRef Path = Input->Obj->getMemoryBufferRef().getBufferIdentifier();
*Conf.ResolutionFile << Path << '\n';
static void writeToResolutionFile(raw_ostream &OS, InputFile *Input,
ArrayRef<SymbolResolution> Res) {
StringRef Path = Input->getMemoryBufferRef().getBufferIdentifier();
OS << Path << '\n';
auto ResI = Res.begin();
for (const InputFile::Symbol &Sym : Input->symbols()) {
assert(ResI != Res.end());
SymbolResolution Res = *ResI++;
*Conf.ResolutionFile << "-r=" << Path << ',' << Sym.getName() << ',';
OS << "-r=" << Path << ',' << Sym.getName() << ',';
if (Res.Prevailing)
*Conf.ResolutionFile << 'p';
OS << 'p';
if (Res.FinalDefinitionInLinkageUnit)
*Conf.ResolutionFile << 'l';
OS << 'l';
if (Res.VisibleToRegularObj)
*Conf.ResolutionFile << 'x';
*Conf.ResolutionFile << '\n';
OS << 'x';
OS << '\n';
}
assert(ResI == Res.end());
}
@ -283,7 +283,7 @@ Error LTO::add(std::unique_ptr<InputFile> Input,
assert(!CalledGetMaxTasks);
if (Conf.ResolutionFile)
writeToResolutionFile(Input.get(), Res);
writeToResolutionFile(*Conf.ResolutionFile, Input.get(), Res);
// FIXME: move to backend
Module &M = Input->Obj->getModule();