[llvm-commits] CVS: llvm/lib/Support/Timer.cpp

Reid Spencer reid at x10sys.com
Mon Dec 13 08:04:16 PST 2004



Changes in directory llvm/lib/Support:

Timer.cpp updated: 1.33 -> 1.34
---
Log message:

Get rid of some leaks found by VC leak detector.
Patch contributed by Morten Ofsted.


---
Diffs of the changes:  (+3 -5)

Index: llvm/lib/Support/Timer.cpp
diff -u llvm/lib/Support/Timer.cpp:1.33 llvm/lib/Support/Timer.cpp:1.34
--- llvm/lib/Support/Timer.cpp:1.33	Thu Nov 18 22:59:07 2004
+++ llvm/lib/Support/Timer.cpp	Mon Dec 13 10:04:04 2004
@@ -33,12 +33,10 @@
 // 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.  We "fix"
-// this by creating the string the first time it is needed and never destroying
-// it.
+// would get destroyed before the Statistic, causing havoc to ensue.
 static std::string &getLibSupportInfoOutputFilename() {
-  static std::string *LibSupportInfoOutputFilename = new std::string();
-  return *LibSupportInfoOutputFilename;
+  static std::string LibSupportInfoOutputFilename;
+  return LibSupportInfoOutputFilename;
 }
 
 namespace {






More information about the llvm-commits mailing list