X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FLeaksContext.h;h=3e485abdfd18056f370b0ba5f825570fb3bf6e74;hb=be63d589633bbfa068b923c60eaaeee1b27647c5;hp=5038dc9d6d6d676f411e34ab95aaaf246837b7cb;hpb=55c06ae7afa3f862a6bb4a4441fe485c135f5b5e;p=oota-llvm.git diff --git a/lib/IR/LeaksContext.h b/lib/IR/LeaksContext.h index 5038dc9d6d6..3e485abdfd1 100644 --- a/lib/IR/LeaksContext.h +++ b/lib/IR/LeaksContext.h @@ -12,8 +12,12 @@ // //===----------------------------------------------------------------------===// +#ifndef LLVM_LIB_IR_LEAKSCONTEXT_H +#define LLVM_LIB_IR_LEAKSCONTEXT_H + #include "llvm/ADT/SmallPtrSet.h" #include "llvm/IR/Value.h" +#include "llvm/Support/raw_ostream.h" namespace llvm { @@ -30,10 +34,10 @@ struct PrinterTrait { template struct LeakDetectorImpl { explicit LeakDetectorImpl(const char* const name = "") : - Cache(0), Name(name) { } + Cache(nullptr), Name(name) { } void clear() { - Cache = 0; + Cache = nullptr; Ts.clear(); } @@ -57,15 +61,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"; @@ -90,3 +94,5 @@ private: }; } + +#endif