[llvm] r325155 - Pass a reference to a module to the bitcode writer.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 14 11:11:32 PST 2018


Author: rafael
Date: Wed Feb 14 11:11:32 2018
New Revision: 325155

URL: http://llvm.org/viewvc/llvm-project?rev=325155&view=rev
Log:
Pass a reference to a module to the bitcode writer.

This simplifies most callers as they are already using references or
std::unique_ptr.

Modified:
    llvm/trunk/include/llvm/Bitcode/BitcodeWriter.h
    llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
    llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
    llvm/trunk/lib/CodeGen/ParallelCG.cpp
    llvm/trunk/lib/FuzzMutate/FuzzerCLI.cpp
    llvm/trunk/lib/LTO/LTOBackend.cpp
    llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
    llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
    llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
    llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
    llvm/trunk/tools/gold/gold-plugin.cpp
    llvm/trunk/tools/llvm-as/llvm-as.cpp
    llvm/trunk/tools/llvm-cat/llvm-cat.cpp
    llvm/trunk/tools/llvm-link/llvm-link.cpp
    llvm/trunk/tools/llvm-lto/llvm-lto.cpp
    llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp
    llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
    llvm/trunk/tools/llvm-split/llvm-split.cpp
    llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp
    llvm/trunk/unittests/Bitcode/BitReaderTest.cpp

Modified: llvm/trunk/include/llvm/Bitcode/BitcodeWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitcodeWriter.h?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitcodeWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitcodeWriter.h Wed Feb 14 11:11:32 2018
@@ -86,7 +86,7 @@ class raw_ostream;
     /// Can be used to produce the same module hash for a minimized bitcode
     /// used just for the thin link as in the regular full bitcode that will
     /// be used in the backend.
-    void writeModule(const Module *M, bool ShouldPreserveUseListOrder = false,
+    void writeModule(const Module &M, bool ShouldPreserveUseListOrder = false,
                      const ModuleSummaryIndex *Index = nullptr,
                      bool GenerateHash = false, ModuleHash *ModHash = nullptr);
 
@@ -97,7 +97,7 @@ class raw_ostream;
     ///
     /// ModHash is for use in ThinLTO incremental build, generated while the
     /// IR bitcode file writing.
-    void writeThinLinkBitcode(const Module *M, const ModuleSummaryIndex &Index,
+    void writeThinLinkBitcode(const Module &M, const ModuleSummaryIndex &Index,
                               const ModuleHash &ModHash);
 
     void writeIndex(
@@ -126,7 +126,7 @@ class raw_ostream;
   /// Can be used to produce the same module hash for a minimized bitcode
   /// used just for the thin link as in the regular full bitcode that will
   /// be used in the backend.
-  void WriteBitcodeToFile(const Module *M, raw_ostream &Out,
+  void WriteBitcodeToFile(const Module &M, raw_ostream &Out,
                           bool ShouldPreserveUseListOrder = false,
                           const ModuleSummaryIndex *Index = nullptr,
                           bool GenerateHash = false,
@@ -139,7 +139,7 @@ class raw_ostream;
   ///
   /// ModHash is for use in ThinLTO incremental build, generated while the IR
   /// bitcode file writing.
-  void WriteThinLinkBitcodeToFile(const Module *M, raw_ostream &Out,
+  void WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
                                   const ModuleSummaryIndex &Index,
                                   const ModuleHash &ModHash);
 

Modified: llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp Wed Feb 14 11:11:32 2018
@@ -25,7 +25,7 @@ int LLVMWriteBitcodeToFile(LLVMModuleRef
   if (EC)
     return -1;
 
-  WriteBitcodeToFile(unwrap(M), OS);
+  WriteBitcodeToFile(*unwrap(M), OS);
   return 0;
 }
 
@@ -33,7 +33,7 @@ int LLVMWriteBitcodeToFD(LLVMModuleRef M
                          int Unbuffered) {
   raw_fd_ostream OS(FD, ShouldClose, Unbuffered);
 
-  WriteBitcodeToFile(unwrap(M), OS);
+  WriteBitcodeToFile(*unwrap(M), OS);
   return 0;
 }
 
@@ -45,6 +45,6 @@ LLVMMemoryBufferRef LLVMWriteBitcodeToMe
   std::string Data;
   raw_string_ostream OS(Data);
 
-  WriteBitcodeToFile(unwrap(M), OS);
+  WriteBitcodeToFile(*unwrap(M), OS);
   return wrap(MemoryBuffer::getMemBufferCopy(OS.str()).release());
 }

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Feb 14 11:11:32 2018
@@ -170,12 +170,12 @@ protected:
 public:
   /// Constructs a ModuleBitcodeWriterBase object for the given Module,
   /// writing to the provided \p Buffer.
-  ModuleBitcodeWriterBase(const Module *M, StringTableBuilder &StrtabBuilder,
+  ModuleBitcodeWriterBase(const Module &M, StringTableBuilder &StrtabBuilder,
                           BitstreamWriter &Stream,
                           bool ShouldPreserveUseListOrder,
                           const ModuleSummaryIndex *Index)
-      : BitcodeWriterBase(Stream, StrtabBuilder), M(*M),
-        VE(*M, ShouldPreserveUseListOrder), Index(Index) {
+      : BitcodeWriterBase(Stream, StrtabBuilder), M(M),
+        VE(M, ShouldPreserveUseListOrder), Index(Index) {
     // Assign ValueIds to any callee values in the index that came from
     // indirect call profiles and were recorded as a GUID not a Value*
     // (which would have been assigned an ID by the ValueEnumerator).
@@ -254,7 +254,7 @@ class ModuleBitcodeWriter : public Modul
 public:
   /// Constructs a ModuleBitcodeWriter object for the given Module,
   /// writing to the provided \p Buffer.
-  ModuleBitcodeWriter(const Module *M, SmallVectorImpl<char> &Buffer,
+  ModuleBitcodeWriter(const Module &M, SmallVectorImpl<char> &Buffer,
                       StringTableBuilder &StrtabBuilder,
                       BitstreamWriter &Stream, bool ShouldPreserveUseListOrder,
                       const ModuleSummaryIndex *Index, bool GenerateHash,
@@ -4038,7 +4038,7 @@ void BitcodeWriter::copyStrtab(StringRef
   WroteStrtab = true;
 }
 
-void BitcodeWriter::writeModule(const Module *M,
+void BitcodeWriter::writeModule(const Module &M,
                                 bool ShouldPreserveUseListOrder,
                                 const ModuleSummaryIndex *Index,
                                 bool GenerateHash, ModuleHash *ModHash) {
@@ -4048,8 +4048,8 @@ void BitcodeWriter::writeModule(const Mo
   // Modules in case it needs to materialize metadata. But the bitcode writer
   // requires that the module is materialized, so we can cast to non-const here,
   // after checking that it is in fact materialized.
-  assert(M->isMaterialized());
-  Mods.push_back(const_cast<Module *>(M));
+  assert(M.isMaterialized());
+  Mods.push_back(const_cast<Module *>(&M));
 
   ModuleBitcodeWriter ModuleWriter(M, Buffer, StrtabBuilder, *Stream,
                                    ShouldPreserveUseListOrder, Index,
@@ -4065,9 +4065,8 @@ void BitcodeWriter::writeIndex(
   IndexWriter.write();
 }
 
-/// WriteBitcodeToFile - Write the specified module to the specified output
-/// stream.
-void llvm::WriteBitcodeToFile(const Module *M, raw_ostream &Out,
+/// Write the specified module to the specified output stream.
+void llvm::WriteBitcodeToFile(const Module &M, raw_ostream &Out,
                               bool ShouldPreserveUseListOrder,
                               const ModuleSummaryIndex *Index,
                               bool GenerateHash, ModuleHash *ModHash) {
@@ -4076,7 +4075,7 @@ void llvm::WriteBitcodeToFile(const Modu
 
   // If this is darwin or another generic macho target, reserve space for the
   // header.
-  Triple TT(M->getTargetTriple());
+  Triple TT(M.getTargetTriple());
   if (TT.isOSDarwin() || TT.isOSBinFormatMachO())
     Buffer.insert(Buffer.begin(), BWH_HeaderSize, 0);
 
@@ -4133,7 +4132,7 @@ class ThinLinkBitcodeWriter : public Mod
   const ModuleHash *ModHash;
 
 public:
-  ThinLinkBitcodeWriter(const Module *M, StringTableBuilder &StrtabBuilder,
+  ThinLinkBitcodeWriter(const Module &M, StringTableBuilder &StrtabBuilder,
                         BitstreamWriter &Stream,
                         const ModuleSummaryIndex &Index,
                         const ModuleHash &ModHash)
@@ -4251,7 +4250,7 @@ void ThinLinkBitcodeWriter::write() {
   Stream.ExitBlock();
 }
 
-void BitcodeWriter::writeThinLinkBitcode(const Module *M,
+void BitcodeWriter::writeThinLinkBitcode(const Module &M,
                                          const ModuleSummaryIndex &Index,
                                          const ModuleHash &ModHash) {
   assert(!WroteStrtab);
@@ -4260,8 +4259,8 @@ void BitcodeWriter::writeThinLinkBitcode
   // Modules in case it needs to materialize metadata. But the bitcode writer
   // requires that the module is materialized, so we can cast to non-const here,
   // after checking that it is in fact materialized.
-  assert(M->isMaterialized());
-  Mods.push_back(const_cast<Module *>(M));
+  assert(M.isMaterialized());
+  Mods.push_back(const_cast<Module *>(&M));
 
   ThinLinkBitcodeWriter ThinLinkWriter(M, StrtabBuilder, *Stream, Index,
                                        ModHash);
@@ -4271,7 +4270,7 @@ void BitcodeWriter::writeThinLinkBitcode
 // Write the specified thin link bitcode file to the given raw output stream,
 // where it will be written in a new bitcode block. This is used when
 // writing the per-module index file for ThinLTO.
-void llvm::WriteThinLinkBitcodeToFile(const Module *M, raw_ostream &Out,
+void llvm::WriteThinLinkBitcodeToFile(const Module &M, raw_ostream &Out,
                                       const ModuleSummaryIndex &Index,
                                       const ModuleHash &ModHash) {
   SmallVector<char, 0> Buffer;

Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriterPass.cpp Wed Feb 14 11:11:32 2018
@@ -23,7 +23,7 @@ PreservedAnalyses BitcodeWriterPass::run
   const ModuleSummaryIndex *Index =
       EmitSummaryIndex ? &(AM.getResult<ModuleSummaryIndexAnalysis>(M))
                        : nullptr;
-  WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash);
+  WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash);
   return PreservedAnalyses::all();
 }
 
@@ -55,7 +55,7 @@ namespace {
           EmitSummaryIndex
               ? &(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex())
               : nullptr;
-      WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index,
+      WriteBitcodeToFile(M, OS, ShouldPreserveUseListOrder, Index,
                          EmitModuleHash);
       return false;
     }

Modified: llvm/trunk/lib/CodeGen/ParallelCG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ParallelCG.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/ParallelCG.cpp (original)
+++ llvm/trunk/lib/CodeGen/ParallelCG.cpp Wed Feb 14 11:11:32 2018
@@ -44,7 +44,7 @@ std::unique_ptr<Module> llvm::splitCodeG
 
   if (OSs.size() == 1) {
     if (!BCOSs.empty())
-      WriteBitcodeToFile(M.get(), *BCOSs[0]);
+      WriteBitcodeToFile(*M, *BCOSs[0]);
     codegen(M.get(), *OSs[0], TMFactory, FileType);
     return M;
   }
@@ -66,7 +66,7 @@ std::unique_ptr<Module> llvm::splitCodeG
           // FIXME: Provide a more direct way to do this in LLVM.
           SmallString<0> BC;
           raw_svector_ostream BCOS(BC);
-          WriteBitcodeToFile(MPart.get(), BCOS);
+          WriteBitcodeToFile(*MPart, BCOS);
 
           if (!BCOSs.empty()) {
             BCOSs[ThreadCount]->write(BC.begin(), BC.size());

Modified: llvm/trunk/lib/FuzzMutate/FuzzerCLI.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/FuzzMutate/FuzzerCLI.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/FuzzMutate/FuzzerCLI.cpp (original)
+++ llvm/trunk/lib/FuzzMutate/FuzzerCLI.cpp Wed Feb 14 11:11:32 2018
@@ -169,7 +169,7 @@ size_t llvm::writeModule(const Module &M
   std::string Buf;
   {
     raw_string_ostream OS(Buf);
-    WriteBitcodeToFile(&M, OS);
+    WriteBitcodeToFile(M, OS);
   }
   if (Buf.size() > MaxSize)
       return 0;

Modified: llvm/trunk/lib/LTO/LTOBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOBackend.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOBackend.cpp (original)
+++ llvm/trunk/lib/LTO/LTOBackend.cpp Wed Feb 14 11:11:32 2018
@@ -82,7 +82,7 @@ Error Config::addSaveTemps(std::string O
       // directly and exit.
       if (EC)
         reportOpenError(Path, EC.message());
-      WriteBitcodeToFile(&M, OS, /*ShouldPreserveUseListOrder=*/false);
+      WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false);
       return true;
     };
   };
@@ -309,7 +309,7 @@ void splitCodeGen(Config &C, TargetMachi
         // FIXME: Provide a more direct way to do this in LLVM.
         SmallString<0> BC;
         raw_svector_ostream BCOS(BC);
-        WriteBitcodeToFile(MPart.get(), BCOS);
+        WriteBitcodeToFile(*MPart, BCOS);
 
         // Enqueue the task
         CodegenThreadPool.async(

Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Wed Feb 14 11:11:32 2018
@@ -220,7 +220,7 @@ bool LTOCodeGenerator::writeMergedModule
   }
 
   // write bitcode to it
-  WriteBitcodeToFile(MergedModule.get(), Out.os(), ShouldEmbedUselists);
+  WriteBitcodeToFile(*MergedModule, Out.os(), ShouldEmbedUselists);
   Out.os().close();
 
   if (Out.os().has_error()) {

Modified: llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp (original)
+++ llvm/trunk/lib/LTO/ThinLTOCodeGenerator.cpp Wed Feb 14 11:11:32 2018
@@ -82,7 +82,7 @@ static void saveTempBitcode(const Module
   if (EC)
     report_fatal_error(Twine("Failed to open ") + SaveTempPath +
                        " to save optimized bitcode\n");
-  WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true);
+  WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
 }
 
 static const GlobalValueSummary *
@@ -476,7 +476,7 @@ ProcessThinLTOModule(Module &TheModule,
       raw_svector_ostream OS(OutputBuffer);
       ProfileSummaryInfo PSI(TheModule);
       auto Index = buildModuleSummaryIndex(TheModule, nullptr, &PSI);
-      WriteBitcodeToFile(&TheModule, OS, true, &Index);
+      WriteBitcodeToFile(TheModule, OS, true, &Index);
     }
     return make_unique<ObjectMemoryBuffer>(std::move(OutputBuffer));
   }

Modified: llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp Wed Feb 14 11:11:32 2018
@@ -202,11 +202,11 @@ void splitAndWriteThinLTOBitcode(
   if (ModuleId.empty()) {
     // We couldn't generate a module ID for this module, just write it out as a
     // regular LTO module.
-    WriteBitcodeToFile(&M, OS);
+    WriteBitcodeToFile(M, OS);
     if (ThinLinkOS)
       // We don't have a ThinLTO part, but still write the module to the
       // ThinLinkOS if requested so that the expected output file is produced.
-      WriteBitcodeToFile(&M, *ThinLinkOS);
+      WriteBitcodeToFile(M, *ThinLinkOS);
     return;
   }
 
@@ -374,10 +374,9 @@ void splitAndWriteThinLTOBitcode(
   // be used in the backends, and use that in the minimized bitcode
   // produced for the full link.
   ModuleHash ModHash = {{0}};
-  W.writeModule(&M, /*ShouldPreserveUseListOrder=*/false, &Index,
+  W.writeModule(M, /*ShouldPreserveUseListOrder=*/false, &Index,
                 /*GenerateHash=*/true, &ModHash);
-  W.writeModule(MergedM.get(), /*ShouldPreserveUseListOrder=*/false,
-                &MergedMIndex);
+  W.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false, &MergedMIndex);
   W.writeSymtab();
   W.writeStrtab();
   OS << Buffer;
@@ -389,8 +388,8 @@ void splitAndWriteThinLTOBitcode(
     Buffer.clear();
     BitcodeWriter W2(Buffer);
     StripDebugInfo(M);
-    W2.writeThinLinkBitcode(&M, Index, ModHash);
-    W2.writeModule(MergedM.get(), /*ShouldPreserveUseListOrder=*/false,
+    W2.writeThinLinkBitcode(M, Index, ModHash);
+    W2.writeModule(*MergedM, /*ShouldPreserveUseListOrder=*/false,
                    &MergedMIndex);
     W2.writeSymtab();
     W2.writeStrtab();
@@ -423,13 +422,13 @@ void writeThinLTOBitcode(raw_ostream &OS
   // be used in the backends, and use that in the minimized bitcode
   // produced for the full link.
   ModuleHash ModHash = {{0}};
-  WriteBitcodeToFile(&M, OS, /*ShouldPreserveUseListOrder=*/false, Index,
+  WriteBitcodeToFile(M, OS, /*ShouldPreserveUseListOrder=*/false, Index,
                      /*GenerateHash=*/true, &ModHash);
   // If a minimized bitcode module was requested for the thin link, only
   // the information that is needed by thin link will be written in the
   // given OS.
   if (ThinLinkOS && Index)
-    WriteThinLinkBitcodeToFile(&M, *ThinLinkOS, *Index, ModHash);
+    WriteThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
 }
 
 class WriteThinLTOBitcode : public ModulePass {

Modified: llvm/trunk/tools/bugpoint/OptimizerDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/OptimizerDriver.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/OptimizerDriver.cpp (original)
+++ llvm/trunk/tools/bugpoint/OptimizerDriver.cpp Wed Feb 14 11:11:32 2018
@@ -52,7 +52,7 @@ static cl::opt<std::string>
 /// file.  If an error occurs, true is returned.
 ///
 static bool writeProgramToFileAux(ToolOutputFile &Out, const Module *M) {
-  WriteBitcodeToFile(M, Out.os(), PreserveBitcodeUseListOrder);
+  WriteBitcodeToFile(*M, Out.os(), PreserveBitcodeUseListOrder);
   Out.os().close();
   if (!Out.os().has_error()) {
     Out.keep();
@@ -69,7 +69,7 @@ bool BugDriver::writeProgramToFile(const
 
 bool BugDriver::writeProgramToFile(int FD, const Module *M) const {
   raw_fd_ostream OS(FD, /*shouldClose*/ false);
-  WriteBitcodeToFile(M, OS, PreserveBitcodeUseListOrder);
+  WriteBitcodeToFile(*M, OS, PreserveBitcodeUseListOrder);
   OS.flush();
   if (!OS.has_error())
     return false;
@@ -158,7 +158,7 @@ bool BugDriver::runPasses(Module *Progra
   DiscardTemp Discard{*Temp};
   raw_fd_ostream OS(Temp->FD, /*shouldClose*/ false);
 
-  WriteBitcodeToFile(Program, OS, PreserveBitcodeUseListOrder);
+  WriteBitcodeToFile(*Program, OS, PreserveBitcodeUseListOrder);
   OS.flush();
   if (OS.has_error()) {
     errs() << "Error writing bitcode file: " << Temp->TmpName << "\n";

Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Wed Feb 14 11:11:32 2018
@@ -784,7 +784,7 @@ static std::unique_ptr<LTO> createLTO(In
       raw_fd_ostream OS(output_name, EC, sys::fs::OpenFlags::F_None);
       if (EC)
         message(LDPL_FATAL, "Failed to write the output file.");
-      WriteBitcodeToFile(&M, OS, /* ShouldPreserveUseListOrder */ false);
+      WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ false);
       return false;
     };
     break;

Modified: llvm/trunk/tools/llvm-as/llvm-as.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-as/llvm-as.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-as/llvm-as.cpp (original)
+++ llvm/trunk/tools/llvm-as/llvm-as.cpp Wed Feb 14 11:11:32 2018
@@ -85,7 +85,7 @@ static void WriteOutputFile(const Module
   }
 
   if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
-    WriteBitcodeToFile(M, Out->os(), PreserveBitcodeUseListOrder, nullptr,
+    WriteBitcodeToFile(*M, Out->os(), PreserveBitcodeUseListOrder, nullptr,
                        EmitModuleHash);
 
   // Declare success.

Modified: llvm/trunk/tools/llvm-cat/llvm-cat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cat/llvm-cat.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cat/llvm-cat.cpp (original)
+++ llvm/trunk/tools/llvm-cat/llvm-cat.cpp Wed Feb 14 11:11:32 2018
@@ -73,7 +73,7 @@ int main(int argc, char **argv) {
         Err.print(argv[0], errs());
         return 1;
       }
-      Writer.writeModule(M.get());
+      Writer.writeModule(*M);
       OwnedMods.push_back(std::move(M));
     }
     Writer.writeStrtab();

Modified: llvm/trunk/tools/llvm-link/llvm-link.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-link/llvm-link.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-link/llvm-link.cpp (original)
+++ llvm/trunk/tools/llvm-link/llvm-link.cpp Wed Feb 14 11:11:32 2018
@@ -398,7 +398,7 @@ int main(int argc, char **argv) {
   if (OutputAssembly) {
     Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
   } else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
-    WriteBitcodeToFile(Composite.get(), Out.os(), PreserveBitcodeUseListOrder);
+    WriteBitcodeToFile(*Composite, Out.os(), PreserveBitcodeUseListOrder);
 
   // Declare success.
   Out.keep();

Modified: llvm/trunk/tools/llvm-lto/llvm-lto.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-lto/llvm-lto.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-lto/llvm-lto.cpp (original)
+++ llvm/trunk/tools/llvm-lto/llvm-lto.cpp Wed Feb 14 11:11:32 2018
@@ -462,7 +462,7 @@ static void writeModuleToFile(Module &Th
   raw_fd_ostream OS(Filename, EC, sys::fs::OpenFlags::F_None);
   error(EC, "error opening the file '" + Filename + "'");
   maybeVerifyModule(TheModule);
-  WriteBitcodeToFile(&TheModule, OS, /* ShouldPreserveUseListOrder */ true);
+  WriteBitcodeToFile(TheModule, OS, /* ShouldPreserveUseListOrder */ true);
 }
 
 class ThinLTOProcessing {

Modified: llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp (original)
+++ llvm/trunk/tools/llvm-modextract/llvm-modextract.cpp Wed Feb 14 11:11:32 2018
@@ -70,7 +70,7 @@ int main(int argc, char **argv) {
   }
 
   std::unique_ptr<Module> M = ExitOnErr(Ms[ModuleIndex].parseModule(Context));
-  WriteBitcodeToFile(M.get(), Out->os());
+  WriteBitcodeToFile(*M, Out->os());
 
   Out->keep();
   return 0;

Modified: llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp (original)
+++ llvm/trunk/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp Wed Feb 14 11:11:32 2018
@@ -77,7 +77,7 @@ extern "C" LLVM_ATTRIBUTE_USED size_t LL
   std::string Buf;
   {
     raw_string_ostream OS(Buf);
-    WriteBitcodeToFile(M.get(), OS);
+    WriteBitcodeToFile(*M, OS);
   }
   if (Buf.size() > MaxSize)
     return 0;

Modified: llvm/trunk/tools/llvm-split/llvm-split.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-split/llvm-split.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-split/llvm-split.cpp (original)
+++ llvm/trunk/tools/llvm-split/llvm-split.cpp Wed Feb 14 11:11:32 2018
@@ -63,7 +63,7 @@ int main(int argc, char **argv) {
     }
 
     verifyModule(*MPart);
-    WriteBitcodeToFile(MPart.get(), Out->os());
+    WriteBitcodeToFile(*MPart, Out->os());
 
     // Declare success.
     Out->keep();

Modified: llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp (original)
+++ llvm/trunk/tools/verify-uselistorder/verify-uselistorder.cpp Wed Feb 14 11:11:32 2018
@@ -132,7 +132,7 @@ bool TempFile::writeBitcode(const Module
     return true;
   }
 
-  WriteBitcodeToFile(&M, OS, /* ShouldPreserveUseListOrder */ true);
+  WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ true);
   return false;
 }
 

Modified: llvm/trunk/unittests/Bitcode/BitReaderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Bitcode/BitReaderTest.cpp?rev=325155&r1=325154&r2=325155&view=diff
==============================================================================
--- llvm/trunk/unittests/Bitcode/BitReaderTest.cpp (original)
+++ llvm/trunk/unittests/Bitcode/BitReaderTest.cpp Wed Feb 14 11:11:32 2018
@@ -44,7 +44,7 @@ std::unique_ptr<Module> parseAssembly(LL
 static void writeModuleToBuffer(std::unique_ptr<Module> Mod,
                                 SmallVectorImpl<char> &Buffer) {
   raw_svector_ostream OS(Buffer);
-  WriteBitcodeToFile(Mod.get(), OS);
+  WriteBitcodeToFile(*Mod, OS);
 }
 
 static std::unique_ptr<Module> getLazyModuleFromAssembly(LLVMContext &Context,




More information about the llvm-commits mailing list