r210115 - Fix leak from r210059
Alp Toker
alp at nuanti.com
Tue Jun 3 10:23:35 PDT 2014
Author: alp
Date: Tue Jun 3 12:23:34 2014
New Revision: 210115
URL: http://llvm.org/viewvc/llvm-project?rev=210115&view=rev
Log:
Fix leak from r210059
Also revert r210096 which temporarily disabled the test while this was being
investigated.
Modified:
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/test/Frontend/disable-output.c
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=210115&r1=210114&r2=210115&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Tue Jun 3 12:23:34 2014
@@ -663,6 +663,8 @@ public:
std::string *ResultPathName,
std::string *TempPathName);
+ llvm::raw_null_ostream *createNullOutputFile();
+
/// }
/// @name Initialization Utility Methods
/// {
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=210115&r1=210114&r2=210115&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Tue Jun 3 12:23:34 2014
@@ -568,7 +568,7 @@ static raw_ostream *GetOutputStream(Comp
case Backend_EmitNothing:
return nullptr;
case Backend_EmitMCNull:
- return new raw_null_ostream();
+ return CI.createNullOutputFile();
case Backend_EmitObj:
return CI.createDefaultOutputFile(true, InFile, "o");
}
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=210115&r1=210114&r2=210115&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue Jun 3 12:23:34 2014
@@ -478,6 +478,12 @@ CompilerInstance::createDefaultOutputFil
/*UseTemporary=*/true);
}
+llvm::raw_null_ostream *CompilerInstance::createNullOutputFile() {
+ llvm::raw_null_ostream *OS = new llvm::raw_null_ostream();
+ addOutputFile(OutputFile("", "", OS));
+ return OS;
+}
+
llvm::raw_fd_ostream *
CompilerInstance::createOutputFile(StringRef OutputPath,
bool Binary, bool RemoveFileOnSignal,
Modified: cfe/trunk/test/Frontend/disable-output.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/disable-output.c?rev=210115&r1=210114&r2=210115&view=diff
==============================================================================
--- cfe/trunk/test/Frontend/disable-output.c (original)
+++ cfe/trunk/test/Frontend/disable-output.c Tue Jun 3 12:23:34 2014
@@ -1,8 +1,7 @@
-// FIXME: this test produces a leak report in clang.
// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -emit-llvm-only -triple=i386-apple-darwin -o %t
// RUN: not rm %t
-// FIXME: %clang_cc1 %s -emit-codegen-only -triple=i386-apple-darwin -o %t
-// FIXME: not rm %t
+// RUN: %clang_cc1 %s -emit-codegen-only -triple=i386-apple-darwin -o %t
+// RUN: not rm %t
// Test that output is not generated when emission is disabled.
More information about the cfe-commits
mailing list