[PATCH] D23943: Make writeToResolutionFile a local static helper, NFC.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 13:00:57 PDT 2016


rafael created this revision.
rafael added reviewers: tejohnson, pcc, mehdi_amini.
rafael added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

https://reviews.llvm.org/D23943

Files:
  include/llvm/LTO/LTO.h
  lib/LTO/LTO.cpp

Index: lib/LTO/LTO.cpp
===================================================================
--- lib/LTO/LTO.cpp
+++ lib/LTO/LTO.cpp
@@ -257,23 +257,23 @@
     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 @@
   assert(!CalledGetMaxTasks);
 
   if (Conf.ResolutionFile)
-    writeToResolutionFile(Input.get(), Res);
+    writeToResolutionFile(*Conf.ResolutionFile, Input.get(), Res);
 
   // FIXME: move to backend
   Module &M = Input->Obj->getModule();
Index: include/llvm/LTO/LTO.h
===================================================================
--- include/llvm/LTO/LTO.h
+++ include/llvm/LTO/LTO.h
@@ -368,8 +368,6 @@
   // 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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23943.69426.patch
Type: text/x-patch
Size: 2147 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160826/8eecce7b/attachment.bin>


More information about the llvm-commits mailing list