[X86] Remove a strange fixme referring to a hack that doesn't seem to exist since...
[oota-llvm.git] / lib / IR / LeaksContext.h
index ea0d2752539273efde5f9959b1bae1d191b5269f..47704fa1a76203a11548b1338379e12d9339c881 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_IR_LEAKSCONTEXT_H
-#define LLVM_IR_LEAKSCONTEXT_H
+#ifndef LLVM_LIB_IR_LEAKSCONTEXT_H
+#define LLVM_LIB_IR_LEAKSCONTEXT_H
 
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/IR/Metadata.h"
 #include "llvm/IR/Value.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -31,13 +32,17 @@ struct PrinterTrait<Value> {
   static void print(const Value* P) { errs() << *P; }
 };
 
+template <> struct PrinterTrait<Metadata> {
+  static void print(const Metadata *P) { P->print(errs()); }
+};
+
 template <typename T>
 struct LeakDetectorImpl {
   explicit LeakDetectorImpl(const char* const name = "") : 
-    Cache(0), Name(name) { }
+    Cache(nullptr), Name(name) { }
 
   void clear() {
-    Cache = 0;
+    Cache = nullptr;
     Ts.clear();
   }
     
@@ -61,15 +66,15 @@ struct LeakDetectorImpl {
 
   void removeGarbage(const T* o) {
     if (o == Cache)
-      Cache = 0; // Cache hit
+      Cache = nullptr; // Cache hit
     else
       Ts.erase(o);
   }
 
   bool hasGarbage(const std::string& Message) {
-    addGarbage(0); // Flush the Cache
+    addGarbage(nullptr); // Flush the Cache
 
-    assert(Cache == 0 && "No value should be cached anymore!");
+    assert(!Cache && "No value should be cached anymore!");
 
     if (!Ts.empty()) {
       errs() << "Leaked " << Name << " objects found: " << Message << ":\n";
@@ -95,4 +100,4 @@ private:
 
 }
 
-#endif // LLVM_IR_LEAKSCONTEXT_H
+#endif