[llvm-commits] [llvm] r141116 - /llvm/trunk/lib/TableGen/TGPreprocessor.cpp

Francois Pichet pichet2000 at gmail.com
Tue Oct 4 14:09:00 PDT 2011


Author: fpichet
Date: Tue Oct  4 16:08:56 2011
New Revision: 141116

URL: http://llvm.org/viewvc/llvm-project?rev=141116&view=rev
Log:
Replace snprintf with raw_string_ostream.

Modified:
    llvm/trunk/lib/TableGen/TGPreprocessor.cpp

Modified: llvm/trunk/lib/TableGen/TGPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGPreprocessor.cpp?rev=141116&r1=141115&r2=141116&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGPreprocessor.cpp (original)
+++ llvm/trunk/lib/TableGen/TGPreprocessor.cpp Tue Oct  4 16:08:56 2011
@@ -24,10 +24,6 @@
 #include <cstdlib>
 #include <cstring>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 namespace llvm {
 typedef std::map<std::string, std::string> TGPPEnvironment;
 
@@ -170,9 +166,10 @@
     if (Kind == tgpprange_list)
       return Vals.at(i);
     else {
-      char buf[32];
-      snprintf(buf, sizeof(buf), "%ld", From + (long int)i);
-      return std::string(buf);
+      std::string Result;
+      raw_string_ostream Tmp(Result);
+      Tmp << (From + (long int)i);
+      return Tmp.str();
     }
   }
 





More information about the llvm-commits mailing list