[llvm] r279859 - Make writeToResolutionFile a static helper.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 13:19:36 PDT 2016


Author: rafael
Date: Fri Aug 26 15:19:35 2016
New Revision: 279859

URL: http://llvm.org/viewvc/llvm-project?rev=279859&view=rev
Log:
Make writeToResolutionFile a static helper.

Modified:
    llvm/trunk/include/llvm/LTO/LTO.h
    llvm/trunk/lib/LTO/LTO.cpp

Modified: llvm/trunk/include/llvm/LTO/LTO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LTO/LTO.h?rev=279859&r1=279858&r2=279859&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LTO/LTO.h (original)
+++ llvm/trunk/include/llvm/LTO/LTO.h Fri Aug 26 15:19:35 2016
@@ -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,

Modified: llvm/trunk/lib/LTO/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTO.cpp?rev=279859&r1=279858&r2=279859&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTO.cpp (original)
+++ llvm/trunk/lib/LTO/LTO.cpp Fri Aug 26 15:19:35 2016
@@ -257,23 +257,23 @@ void LTO::addSymbolToGlobalRes(IRObjectF
     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
   assert(!CalledGetMaxTasks);
 
   if (Conf.ResolutionFile)
-    writeToResolutionFile(Input.get(), Res);
+    writeToResolutionFile(*Conf.ResolutionFile, Input.get(), Res);
 
   // FIXME: move to backend
   Module &M = Input->Obj->getModule();




More information about the llvm-commits mailing list