[llvm-commits] [llvm] r55248 - /llvm/trunk/include/llvm/Support/raw_ostream.h

Chris Lattner sabre at nondot.org
Sat Aug 23 12:27:03 PDT 2008


Author: lattner
Date: Sat Aug 23 14:27:03 2008
New Revision: 55248

URL: http://llvm.org/viewvc/llvm-project?rev=55248&view=rev
Log:
conditionalize this to work on windows, untested but it should work
according to the intarnetz

Modified:
    llvm/trunk/include/llvm/Support/raw_ostream.h

Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=55248&r1=55247&r2=55248&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Sat Aug 23 14:27:03 2008
@@ -17,6 +17,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include <cassert>
 #include <cstring>
+#include <cstdio>
 #include <string>
 #include <iosfwd>
 
@@ -173,7 +174,11 @@
   /// 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.





More information about the llvm-commits mailing list