r234598 - Return std::unique_ptr to avoid a release and recreate.
Rafael Espindola
rafael.espindola at gmail.com
Fri Apr 10 07:30:43 PDT 2015
Author: rafael
Date: Fri Apr 10 09:30:43 2015
New Revision: 234598
URL: http://llvm.org/viewvc/llvm-project?rev=234598&view=rev
Log:
Return std::unique_ptr to avoid a release and recreate.
Modified:
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=234598&r1=234597&r2=234598&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Fri Apr 10 09:30:43 2015
@@ -669,7 +669,7 @@ public:
/// stored here on success.
/// \param TempPathName [out] - If given, the temporary file path name
/// will be stored here on success.
- static llvm::raw_fd_ostream *
+ static std::unique_ptr<llvm::raw_fd_ostream>
createOutputFile(StringRef OutputPath, std::error_code &Error, bool Binary,
bool RemoveFileOnSignal, StringRef BaseInput,
StringRef Extension, bool UseTemporary,
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=234598&r1=234597&r2=234598&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Fri Apr 10 09:30:43 2015
@@ -575,9 +575,9 @@ CompilerInstance::createOutputFile(Strin
bool CreateMissingDirectories) {
std::string OutputPathName, TempPathName;
std::error_code EC;
- std::unique_ptr<llvm::raw_fd_ostream> OS(createOutputFile(
+ std::unique_ptr<llvm::raw_fd_ostream> OS = createOutputFile(
OutputPath, EC, Binary, RemoveFileOnSignal, InFile, Extension,
- UseTemporary, CreateMissingDirectories, &OutputPathName, &TempPathName));
+ UseTemporary, CreateMissingDirectories, &OutputPathName, &TempPathName);
if (!OS) {
getDiagnostics().Report(diag::err_fe_unable_to_open_output) << OutputPath
<< EC.message();
@@ -593,7 +593,7 @@ CompilerInstance::createOutputFile(Strin
return Ret;
}
-llvm::raw_fd_ostream *CompilerInstance::createOutputFile(
+std::unique_ptr<llvm::raw_fd_ostream> CompilerInstance::createOutputFile(
StringRef OutputPath, std::error_code &Error, bool Binary,
bool RemoveFileOnSignal, StringRef InFile, StringRef Extension,
bool UseTemporary, bool CreateMissingDirectories,
@@ -681,7 +681,7 @@ llvm::raw_fd_ostream *CompilerInstance::
if (TempPathName)
*TempPathName = TempFile;
- return OS.release();
+ return OS;
}
// Initialization Utilities
More information about the cfe-commits
mailing list