aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/LeakDetector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/LeakDetector.cpp')
-rw-r--r--lib/Support/LeakDetector.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Support/LeakDetector.cpp b/lib/Support/LeakDetector.cpp
index a6d96df7ba..d4e829f1d9 100644
--- a/lib/Support/LeakDetector.cpp
+++ b/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;
}
}