[llvm-commits] CVS: llvm/lib/Support/Timer.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 13 19:55:31 PST 2004
Changes in directory llvm/lib/Support:
Timer.cpp updated: 1.34 -> 1.35
---
Log message:
Revert the last patch as it causes a static destruction ordering problem.
---
Diffs of the changes: (+5 -3)
Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.34 llvm/lib/Support/Timer.cpp:1.35
--- llvm/lib/Support/Timer.cpp:1.34 Mon Dec 13 10:04:04 2004
+++ llvm/lib/Support/Timer.cpp Mon Dec 13 21:55:21 2004
@@ -33,10 +33,12 @@
// problem is that a Statistic<> object gets destroyed, which ends up calling
// 'GetLibSupportInfoOutputFile()' (below), which calls this function.
// LibSupportInfoOutputFilename used to be a global variable, but sometimes it
-// would get destroyed before the Statistic, causing havoc to ensue.
+// would get destroyed before the Statistic, causing havoc to ensue. We "fix"
+// this by creating the string the first time it is needed and never destroying
+// it.
static std::string &getLibSupportInfoOutputFilename() {
- static std::string LibSupportInfoOutputFilename;
- return LibSupportInfoOutputFilename;
+ static std::string *LibSupportInfoOutputFilename = new std::string();
+ return *LibSupportInfoOutputFilename;
}
namespace {
More information about the llvm-commits
mailing list