aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CppBackend
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-08-21 00:14:44 +0000
committerOwen Anderson <resistor@mac.com>2008-08-21 00:14:44 +0000
commitcb3718832375a581c5ea23f15918f3ea447a446c (patch)
treea72c740cc8590cd63825fcf08f71c5e2f625ca55 /lib/Target/CppBackend
parentf4a97da4072a2ee4aca3c668a9fa113c06fdef8d (diff)
downloadexternal_llvm-cb3718832375a581c5ea23f15918f3ea447a446c.zip
external_llvm-cb3718832375a581c5ea23f15918f3ea447a446c.tar.gz
external_llvm-cb3718832375a581c5ea23f15918f3ea447a446c.tar.bz2
Use raw_ostream throughout the AsmPrinter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CppBackend')
-rw-r--r--lib/Target/CppBackend/CPPBackend.cpp21
-rw-r--r--lib/Target/CppBackend/CPPTargetMachine.h4
2 files changed, 14 insertions, 11 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp
index fc5be98..33326e1 100644
--- a/lib/Target/CppBackend/CPPBackend.cpp
+++ b/lib/Target/CppBackend/CPPBackend.cpp
@@ -29,6 +29,7 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/Config/config.h"
#include <algorithm>
#include <set>
@@ -86,7 +87,7 @@ namespace {
/// module to a C++ translation unit.
class CppWriter : public ModulePass {
const char* progname;
- std::ostream &Out;
+ raw_ostream &Out;
const Module *TheModule;
uint64_t uniqueNum;
TypeMap TypeNames;
@@ -101,7 +102,7 @@ namespace {
public:
static char ID;
- explicit CppWriter(std::ostream &o) :
+ explicit CppWriter(raw_ostream &o) :
ModulePass((intptr_t)&ID), Out(o), uniqueNum(0), is_inline(false) {}
virtual const char *getPassName() const { return "C++ backend"; }
@@ -154,7 +155,7 @@ namespace {
};
static unsigned indent_level = 0;
- inline std::ostream& nl(std::ostream& Out, int delta = 0) {
+ inline raw_ostream& nl(raw_ostream& Out, int delta = 0) {
Out << "\n";
if (delta >= 0 || indent_level >= unsigned(-delta))
indent_level += delta;
@@ -252,13 +253,13 @@ namespace {
else
Out << StrVal << "f";
} else if (CFP->getType() == Type::DoubleTy)
- Out << "BitsToDouble(0x" << std::hex
- << CFP->getValueAPF().convertToAPInt().getZExtValue()
- << std::dec << "ULL) /* " << StrVal << " */";
+ Out << "BitsToDouble(0x"
+ << utohexstr(CFP->getValueAPF().convertToAPInt().getZExtValue())
+ << "ULL) /* " << StrVal << " */";
else
- Out << "BitsToFloat(0x" << std::hex
- << (uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue()
- << std::dec << "U) /* " << StrVal << " */";
+ Out << "BitsToFloat(0x"
+ << utohexstr((uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue())
+ << "U) /* " << StrVal << " */";
Out << ")";
#if HAVE_PRINTF_A
}
@@ -1982,7 +1983,7 @@ char CppWriter::ID = 0;
//===----------------------------------------------------------------------===//
bool CPPTargetMachine::addPassesToEmitWholeFile(PassManager &PM,
- std::ostream &o,
+ raw_ostream &o,
CodeGenFileType FileType,
bool Fast) {
if (FileType != TargetMachine::AssemblyFile) return true;
diff --git a/lib/Target/CppBackend/CPPTargetMachine.h b/lib/Target/CppBackend/CPPTargetMachine.h
index 4170cdf..db17c17 100644
--- a/lib/Target/CppBackend/CPPTargetMachine.h
+++ b/lib/Target/CppBackend/CPPTargetMachine.h
@@ -19,6 +19,8 @@
namespace llvm {
+class raw_ostream;
+
struct CPPTargetMachine : public TargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
@@ -26,7 +28,7 @@ struct CPPTargetMachine : public TargetMachine {
: DataLayout(&M) {}
virtual bool WantsWholeFile() const { return true; }
- virtual bool addPassesToEmitWholeFile(PassManager &PM, std::ostream &Out,
+ virtual bool addPassesToEmitWholeFile(PassManager &PM, raw_ostream &Out,
CodeGenFileType FileType, bool Fast);
// This class always works, but shouldn't be the default in most cases.