[PATCH] D26884: Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 19 10:29:45 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL287449: Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC) (authored by mehdi_amini).

Changed prior to commit:
  https://reviews.llvm.org/D26884?vs=78618&id=78637#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26884

Files:
  cfe/trunk/lib/CodeGen/CodeGenAction.cpp
  llvm/trunk/include/llvm/IR/LLVMContext.h
  llvm/trunk/lib/IR/LLVMContext.cpp
  llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
  llvm/trunk/tools/opt/opt.cpp


Index: llvm/trunk/tools/opt/opt.cpp
===================================================================
--- llvm/trunk/tools/opt/opt.cpp
+++ llvm/trunk/tools/opt/opt.cpp
@@ -424,7 +424,8 @@
       errs() << EC.message() << '\n';
       return 1;
     }
-    Context.setDiagnosticsOutputFile(new yaml::Output(YamlFile->os()));
+    Context.setDiagnosticsOutputFile(
+        llvm::make_unique<yaml::Output>(YamlFile->os()));
   }
 
   // Load the input module...
Index: llvm/trunk/include/llvm/IR/LLVMContext.h
===================================================================
--- llvm/trunk/include/llvm/IR/LLVMContext.h
+++ llvm/trunk/include/llvm/IR/LLVMContext.h
@@ -194,7 +194,7 @@
   /// By default or if invoked with null, diagnostics are not saved in a file
   /// but only emitted via the diagnostic handler.  Even if an output file is
   /// set, the handler is invoked for each diagnostic message.
-  void setDiagnosticsOutputFile(yaml::Output *F);
+  void setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F);
 
   /// \brief Get the prefix that should be printed in front of a diagnostic of
   ///        the given \p Severity
Index: llvm/trunk/lib/IR/LLVMContext.cpp
===================================================================
--- llvm/trunk/lib/IR/LLVMContext.cpp
+++ llvm/trunk/lib/IR/LLVMContext.cpp
@@ -212,8 +212,8 @@
   return pImpl->DiagnosticsOutputFile.get();
 }
 
-void LLVMContext::setDiagnosticsOutputFile(yaml::Output *F) {
-  pImpl->DiagnosticsOutputFile.reset(F);
+void LLVMContext::setDiagnosticsOutputFile(std::unique_ptr<yaml::Output> F) {
+  pImpl->DiagnosticsOutputFile = std::move(F);
 }
 
 LLVMContext::DiagnosticHandlerTy LLVMContext::getDiagnosticHandler() const {
Index: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
===================================================================
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
@@ -511,7 +511,7 @@
       return false;
     }
     Context.setDiagnosticsOutputFile(
-        new yaml::Output(DiagnosticOutputFile->os()));
+        llvm::make_unique<yaml::Output>(DiagnosticOutputFile->os()));
   }
   return true;
 }
Index: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp
@@ -195,7 +195,8 @@
           return;
         }
 
-        Ctx.setDiagnosticsOutputFile(new yaml::Output(OptRecordFile->os()));
+        Ctx.setDiagnosticsOutputFile(
+            llvm::make_unique<yaml::Output>(OptRecordFile->os()));
 
         if (CodeGenOpts.getProfileUse() != CodeGenOptions::ProfileNone)
           Ctx.setDiagnosticHotnessRequested(true);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26884.78637.patch
Type: text/x-patch
Size: 2725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161119/b0e0b110/attachment.bin>


More information about the llvm-commits mailing list