Fix XCoreTargetLowering::isLegalAddressingMode() to handle VoidTy.
[oota-llvm.git] / lib / VMCore / LeaksContext.h
index b0c3a14fe84aa25787d5f1cd01122b97734b571c..abff090b87963ff4701cd50863b73d9f3db5b054 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "llvm/Value.h"
 #include "llvm/ADT/SmallPtrSet.h"
-#include "llvm/Support/raw_ostream.h"
 using namespace llvm;
 
 template <class T>
@@ -47,8 +46,9 @@ struct LeakDetectorImpl {
   // immediately, it is added to the CachedValue Value.  If it is
   // immediately removed, no set search need be performed.
   void addGarbage(const T* o) {
+    assert(Ts.count(o) == 0 && "Object already in set!");
     if (Cache) {
-      assert(Ts.count(Cache) == 0 && "Object already in set!");
+      assert(Cache != o && "Object already in set!");
       Ts.insert(Cache);
     }
     Cache = o;