diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-21 00:14:44 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-21 00:14:44 +0000 |
commit | cb3718832375a581c5ea23f15918f3ea447a446c (patch) | |
tree | a72c740cc8590cd63825fcf08f71c5e2f625ca55 /include/llvm/Support | |
parent | f4a97da4072a2ee4aca3c668a9fa113c06fdef8d (diff) |
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 'include/llvm/Support')
-rw-r--r-- | include/llvm/Support/raw_ostream.h | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 1694520084..8019e44e35 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -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) |