switch from std::ostream to raw ostream, fix file header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-23 03:56:06 +00:00
parent c02497f5ba
commit b93a9a66ba

View File

@ -1,4 +1,4 @@
//===---------------- ----LeaksContext.h - Implementation ------*- C++ -*--===// //===- LeaksContext.h - LeadDetector Implementation ------------*- C++ -*--===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -13,19 +13,18 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/Value.h" #include "llvm/Value.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm; using namespace llvm;
template <class T> template <class T>
struct PrinterTrait { struct PrinterTrait {
static void print(const T* P) { cerr << P; } static void print(const T* P) { errs() << P; }
}; };
template<> template<>
struct PrinterTrait<Value> { struct PrinterTrait<Value> {
static void print(const Value* P) { cerr << *P; } static void print(const Value* P) { errs() << *P; }
}; };
template <typename T> template <typename T>
@ -68,14 +67,14 @@ struct LeakDetectorImpl {
assert(Cache == 0 && "No value should be cached anymore!"); assert(Cache == 0 && "No value should be cached anymore!");
if (!Ts.empty()) { if (!Ts.empty()) {
cerr << "Leaked " << Name << " objects found: " << Message << ":\n"; errs() << "Leaked " << Name << " objects found: " << Message << ":\n";
for (typename SmallPtrSet<const T*, 8>::iterator I = Ts.begin(), for (typename SmallPtrSet<const T*, 8>::iterator I = Ts.begin(),
E = Ts.end(); I != E; ++I) { E = Ts.end(); I != E; ++I) {
cerr << "\t"; errs() << '\t';
PrinterTrait<T>::print(*I); PrinterTrait<T>::print(*I);
cerr << "\n"; errs() << '\n';
} }
cerr << '\n'; errs() << '\n';
return true; return true;
} }