summaryrefslogtreecommitdiff
path: root/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-12-14 03:55:21 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-12-14 03:55:21 +0000
commitf6e5a25f3a57a225c8545e453045f3ae220e3286 (patch)
treef0caac0db7bbf859d269a45fe7e437b5e7336eee /lib/Support/Timer.cpp
parent93f8f55e19c29e1889dc72eb62292c383e76d3a0 (diff)
downloadllvm-f6e5a25f3a57a225c8545e453045f3ae220e3286.tar.gz
llvm-f6e5a25f3a57a225c8545e453045f3ae220e3286.tar.bz2
llvm-f6e5a25f3a57a225c8545e453045f3ae220e3286.tar.xz
Revert the last patch as it causes a static destruction ordering problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18925 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r--lib/Support/Timer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index 4b88be2b09..ff3fd6fefe 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -33,10 +33,12 @@ namespace llvm { extern std::ostream *GetLibSupportInfoOutputFile(); }
// 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 {