/// print - Print out the bounds to a stream...
///
void ConstantRange::print(std::ostream &OS) const {
- OS << "[" << Lower << "," << Upper << " )";
+ OS << "[" << *Lower << "," << *Upper << " )";
}
/// dump - Allow printing from a debugger easily...
/// print - Print out the bounds to a stream...
///
void ConstantRange::print(std::ostream &OS) const {
- OS << "[" << Lower << "," << Upper << " )";
+ OS << "[" << *Lower << "," << *Upper << " )";
}
/// dump - Allow printing from a debugger easily...
using namespace llvm;
namespace {
+ template <class T>
+ struct PrinterTrait {
+ static void print(const T* P) { std::cerr << P; }
+ };
+
+ template<>
+ struct PrinterTrait<Value> {
+ static void print(const Value* P) { std::cerr << *P; }
+ };
+
template <typename T>
struct LeakDetectorImpl {
LeakDetectorImpl(const char* const name) : Cache(0), Name(name) { }
if (o == Cache)
Cache = 0; // Cache hit
else
- Ts.erase(o);
+ Ts.erase(o);
}
bool hasGarbage(const std::string& Message) {
if (!Ts.empty()) {
std::cerr
- << "Leaked " << Name << " objects found: " << Message << ":\n\t";
- std::copy(Ts.begin(), Ts.end(),
- std::ostream_iterator<const T*>(std::cerr, " "));
+ << "Leaked " << Name << " objects found: " << Message << ":\n";
+ for (typename std::set<const T*>::iterator I = Ts.begin(),
+ E = Ts.end(); I != E; ++I) {
+ std::cerr << "\t";
+ PrinterTrait<T>::print(*I);
+ std::cerr << "\n";
+ }
std::cerr << '\n';
// Clear out results so we don't get duplicate warnings on
/// print - Print out the bounds to a stream...
///
void ConstantRange::print(std::ostream &OS) const {
- OS << "[" << Lower << "," << Upper << " )";
+ OS << "[" << *Lower << "," << *Upper << " )";
}
/// dump - Allow printing from a debugger easily...
using namespace llvm;
namespace {
+ template <class T>
+ struct PrinterTrait {
+ static void print(const T* P) { std::cerr << P; }
+ };
+
+ template<>
+ struct PrinterTrait<Value> {
+ static void print(const Value* P) { std::cerr << *P; }
+ };
+
template <typename T>
struct LeakDetectorImpl {
LeakDetectorImpl(const char* const name) : Cache(0), Name(name) { }
if (o == Cache)
Cache = 0; // Cache hit
else
- Ts.erase(o);
+ Ts.erase(o);
}
bool hasGarbage(const std::string& Message) {
if (!Ts.empty()) {
std::cerr
- << "Leaked " << Name << " objects found: " << Message << ":\n\t";
- std::copy(Ts.begin(), Ts.end(),
- std::ostream_iterator<const T*>(std::cerr, " "));
+ << "Leaked " << Name << " objects found: " << Message << ":\n";
+ for (typename std::set<const T*>::iterator I = Ts.begin(),
+ E = Ts.end(); I != E; ++I) {
+ std::cerr << "\t";
+ PrinterTrait<T>::print(*I);
+ std::cerr << "\n";
+ }
std::cerr << '\n';
// Clear out results so we don't get duplicate warnings on