Replace snprintf with raw_string_ostream.
authorFrancois Pichet <pichet2000@gmail.com>
Tue, 4 Oct 2011 21:08:56 +0000 (21:08 +0000)
committerFrancois Pichet <pichet2000@gmail.com>
Tue, 4 Oct 2011 21:08:56 +0000 (21:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141116 91177308-0d34-0410-b5e6-96231b3b80d8

lib/TableGen/TGPreprocessor.cpp

index 6c82ee38302c3bd4f78c753dd00c359e63936db0..0fa5562d7dcffdbd8279111d1f19b55abd28365a 100644 (file)
 #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 @@ public:
     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();
     }
   }