Use raw_ostream throughout the AsmPrinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson
2008-08-21 00:14:44 +00:00
parent f4a97da407
commit cb37188323
66 changed files with 448 additions and 180 deletions

View File

@@ -27,6 +27,7 @@
#include "llvm/Support/SystemUtils.h"
#include "llvm/Support/Mangler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Signals.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/LoopPass.h"
@@ -162,9 +163,12 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
sys::RemoveFileOnSignal(uniqueAsmPath);
// generate assembly code
std::ofstream asmFile(uniqueAsmPath.c_str());
bool genResult = this->generateAssemblyCode(asmFile, errMsg);
asmFile.close();
std::string error;
bool genResult = false;
{
raw_fd_ostream asmFile(uniqueAsmPath.c_str(), error);
genResult = this->generateAssemblyCode(asmFile, errMsg);
}
if ( genResult ) {
if ( uniqueAsmPath.exists() )
uniqueAsmPath.eraseFromDisk();
@@ -309,7 +313,8 @@ void LTOCodeGenerator::applyScopeRestrictions()
}
/// Optimize merged modules using various IPO passes
bool LTOCodeGenerator::generateAssemblyCode(std::ostream& out, std::string& errMsg)
bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out,
std::string& errMsg)
{
if ( this->determineTarget(errMsg) )
return true;