Add a function to convert a double to a string


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/Tools/StringExtras.h b/include/llvm/Tools/StringExtras.h
index 31dedb4..819da2f 100644
--- a/include/llvm/Tools/StringExtras.h
+++ b/include/llvm/Tools/StringExtras.h
@@ -9,6 +9,7 @@
 #define LLVM_TOOLS_STRING_EXTRAS_H
 
 #include <string>
+#include <stdio.h>
 #include "llvm/Tools/DataTypes.h"
 
 static inline string utostr(uint64_t X, bool isNeg = false) {
@@ -60,4 +61,10 @@
     return utostr((unsigned)X);
 }
 
+static inline string ftostr(double V) {
+  char Buffer[200];
+  snprintf(Buffer, 200, "%f", V);
+  return Buffer;
+}
+
 #endif