Revert the last patch as it causes a static destruction ordering problem.
authorReid Spencer <rspencer@reidspencer.com>
Tue, 14 Dec 2004 03:55:21 +0000 (03:55 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Tue, 14 Dec 2004 03:55:21 +0000 (03:55 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18925 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Timer.cpp

index 4b88be2b094749ead52cc1270ef0e4927e66049e..ff3fd6fefe02ecd6e580909dc875695dec2b7e6b 100644 (file)
@@ -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 {