Index: runtime/vm/version_in.cc |
=================================================================== |
--- runtime/vm/version_in.cc (revision 22412) |
+++ runtime/vm/version_in.cc (working copy) |
@@ -4,8 +4,28 @@ |
#include "vm/version.h" |
+#include "vm/cpu.h" |
+#include "vm/os.h" |
+ |
namespace dart { |
+// TODO(iposva): Avoid racy initialization. |
+static const char* formatted_version = NULL; |
+ |
+const char* Version::String() { |
+ if (formatted_version == NULL) { |
+ const char* format = "%s on \"%s_%s\""; |
+ const char* os = OS::Name(); |
+ const char* arch = CPU::Id(); |
+ |
+ intptr_t len = OS::SNPrint(NULL, 0, format, str_, os, arch); |
+ char* buffer = reinterpret_cast<char*>(malloc(len + 1)); |
+ OS::SNPrint(buffer, (len + 1), format, str_, os, arch); |
+ formatted_version = buffer; |
+ } |
+ return formatted_version; |
+} |
+ |
const char* Version::str_ = "{{VERSION_STR}} ({{BUILD_TIME}})"; |
} // namespace dart |