Do not let 'ftostr' return a string that starts with spaces. This allows
[oota-llvm.git] / include / llvm / ADT / StringExtras.h
index 7e25f654d8fd1ac4de0584a98eecfd86b09b6aaa..e6d1feac1ab4f7cb9c0b00ab6986a678c7d79008 100644 (file)
@@ -100,7 +100,9 @@ static inline std::string itostr(int X) {
 static inline std::string ftostr(double V) {
   char Buffer[200];
   sprintf(Buffer, "%20.6e", V);
-  return Buffer;
+  char *B = Buffer;
+  while (*B == ' ') ++B;
+  return B;
 }
 
 static inline std::string LowercaseString(const std::string &S) {