diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-08-23 19:27:03 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-08-23 19:27:03 +0000 |
| commit | 131259515302ac7ef150fd032a1537243c5c0a6e (patch) | |
| tree | 1ca66acd5da9d1b02d1faaa9cd1a18b47ada7e9a /llvm | |
| parent | 0116530ba22544a1256d70ba92f1b4670f75599b (diff) | |
| download | bcm5719-llvm-131259515302ac7ef150fd032a1537243c5c0a6e.tar.gz bcm5719-llvm-131259515302ac7ef150fd032a1537243c5c0a6e.zip | |
conditionalize this to work on windows, untested but it should work
according to the intarnetz
llvm-svn: 55248
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Support/raw_ostream.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h index 58d5be27417..db312f87358 100644 --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -17,6 +17,7 @@ #include "llvm/ADT/StringExtras.h" #include <cassert> #include <cstring> +#include <cstdio> #include <string> #include <iosfwd> @@ -173,7 +174,11 @@ public: /// returns the length of the formatted string. If the buffer is too small, /// this returns a length to retry with, which will be larger than BufferSize. virtual unsigned print(char *Buffer, unsigned BufferSize) const { +#ifdef WIN32 + int N = _snprintf(Buffer, BufferSize-1, Fmt, Val); +#else int N = snprintf(Buffer, BufferSize-1, Fmt, Val); +#endif if (N < 0) // VC++ and old GlibC return negative on overflow. return BufferSize*2; if (unsigned(N) >= BufferSize-1)// Other impls yield number of bytes needed. |

