summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-15 23:33:48 +0000
committerChris Lattner <sabre@nondot.org>2004-02-15 23:33:48 +0000
commit5f25fb0dd732c7604eee61b89428213dbc4bf37e (patch)
treeb8167674744b8911a2a50e19d84c359203394258 /llvm/lib/Support
parentaebc66a1ef1cd61c214a7ed976840500797804e5 (diff)
downloadbcm5719-llvm-5f25fb0dd732c7604eee61b89428213dbc4bf37e.tar.gz
bcm5719-llvm-5f25fb0dd732c7604eee61b89428213dbc4bf37e.zip
Fix a bug in the recent rewrite of the leakdetector that caused all of the
nightly tests to be really messed up. The problem was that the new leakdetector was depending on undefined behavior: the order of destruction of static objects. llvm-svn: 11488
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/LeakDetector.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/Support/LeakDetector.cpp b/llvm/lib/Support/LeakDetector.cpp
index a6d96df7ba1..d4e829f1d98 100644
--- a/llvm/lib/Support/LeakDetector.cpp
+++ b/llvm/lib/Support/LeakDetector.cpp
@@ -17,7 +17,6 @@
using namespace llvm;
namespace {
-
template <typename T>
struct LeakDetectorImpl {
LeakDetectorImpl(const char* const name) : Cache(0), Name(name) { }
@@ -64,21 +63,25 @@ namespace {
private:
std::set<const T*> Ts;
- const T* Cache;
- const char* const Name;
+ const T* Cache;
+ const char* const Name;
};
typedef LeakDetectorImpl<void> Objects;
typedef LeakDetectorImpl<Value> LLVMObjects;
Objects& getObjects() {
- static Objects o("GENERIC");
- return o;
+ static Objects *o = 0;
+ if (o == 0)
+ o = new Objects("GENERIC");
+ return *o;
}
LLVMObjects& getLLVMObjects() {
- static LLVMObjects o("LLVM");
- return o;
+ static LLVMObjects *o = 0;
+ if (o == 0)
+ o = new LLVMObjects("LLVM");
+ return *o;
}
}
OpenPOWER on IntegriCloud