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

@ -14,6 +14,7 @@
#ifndef LLVM_SUPPORT_RAW_OSTREAM_H
#define LLVM_SUPPORT_RAW_OSTREAM_H
#include "llvm/ADT/StringExtras.h"
#include <cassert>
#include <cstring>
#include <string>
@ -72,7 +73,11 @@ public:
return write(Str, strlen(Str));
}
raw_ostream &operator<<(unsigned N) {
raw_ostream &operator<<(const std::string& Str) {
return write(Str.data(), Str.length());
}
raw_ostream &operator<<(uint64_t N) {
// Zero is a special case.
if (N == 0)
return *this << '0';
@ -88,6 +93,34 @@ public:
return write(CurPtr, EndPtr-CurPtr);
}
raw_ostream &operator<<(int64_t N) {
if (N < 0) {
if (OutBufCur >= OutBufEnd)
flush_impl();
*OutBufCur++ = '-';
N = -N;
}
return this->operator<<(static_cast<uint64_t>(N));
}
raw_ostream &operator<<(uint32_t N) {
return this->operator<<(static_cast<uint64_t>(N));
}
raw_ostream &operator<<(int32_t N) {
return this->operator<<(static_cast<int64_t>(N));
}
raw_ostream &operator<<(size_t N) {
return this->operator<<(static_cast<uint64_t>(N));
}
raw_ostream &operator<<(double N) {
return this->operator<<(ftostr(N));
}
raw_ostream &write(const char *Ptr, unsigned Size) {
if (OutBufCur+Size > OutBufEnd)