Changed to using LLVM streams.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31955 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2006-11-28 02:09:03 +00:00
parent d9fd2acc1f
commit 8f48766286
6 changed files with 34 additions and 35 deletions

View File

@ -26,10 +26,11 @@
#include "llvm/Instructions.h"
#include "llvm/Module.h"
#include "llvm/SymbolTable.h"
#include "llvm/Support/CFG.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Streams.h"
#include <algorithm>
using namespace llvm;
@ -866,7 +867,7 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
case GlobalValue::ExternalLinkage: break;
case GlobalValue::GhostLinkage:
std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
abort();
}
@ -965,7 +966,7 @@ void AssemblyWriter::printFunction(const Function *F) {
case GlobalValue::ExternalWeakLinkage: Out << "extern_weak "; break;
case GlobalValue::ExternalLinkage: break;
case GlobalValue::GhostLinkage:
std::cerr << "GhostLinkage not allowed in AsmWriter!\n";
llvm_cerr << "GhostLinkage not allowed in AsmWriter!\n";
abort();
}
@ -1358,11 +1359,11 @@ void Argument::print(std::ostream &o) const {
// Value::dump - allow easy printing of Values from the debugger.
// Located here because so much of the needed functionality is here.
void Value::dump() const { print(std::cerr); std::cerr << '\n'; }
void Value::dump() const { print(std::cerr); llvm_cerr << '\n'; }
// Type::dump - allow easy printing of Values from the debugger.
// Located here because so much of the needed functionality is here.
void Type::dump() const { print(std::cerr); std::cerr << '\n'; }
void Type::dump() const { print(std::cerr); llvm_cerr << '\n'; }
//===----------------------------------------------------------------------===//
// CachedWriter Class Implementation
@ -1413,7 +1414,7 @@ CachedWriter& CachedWriter::operator<<(const Type &Ty) {
//===----------------------------------------------------------------------===//
#if 0
#define SC_DEBUG(X) std::cerr << X
#define SC_DEBUG(X) llvm_cerr << X
#else
#define SC_DEBUG(X)
#endif

View File

@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Assembly/AutoUpgrade.h"
#include "llvm/Support/Streams.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
@ -19,7 +20,6 @@
#include "llvm/Instructions.h"
#include "llvm/Intrinsics.h"
#include "llvm/SymbolTable.h"
#include <iostream>
using namespace llvm;
static Function *getUpgradedUnaryFn(Function *F) {
@ -193,7 +193,7 @@ Function *llvm::UpgradeIntrinsicFunction(Function* F) {
// See if its one of the name's we're interested in.
if (Function *R = getUpgradedIntrinsic(F)) {
if (R->getName() != F->getName())
std::cerr << "WARNING: change " << F->getName() << " to "
llvm_cerr << "WARNING: change " << F->getName() << " to "
<< R->getName() << "\n";
return R;
}

View File

@ -11,22 +11,22 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/LeakDetector.h"
#include "llvm/Support/Streams.h"
#include "llvm/Value.h"
#include <iostream>
#include <set>
using namespace llvm;
namespace {
template <class T>
struct VISIBILITY_HIDDEN PrinterTrait {
static void print(const T* P) { std::cerr << P; }
static void print(const T* P) { llvm_cerr << P; }
};
template<>
struct VISIBILITY_HIDDEN PrinterTrait<Value> {
static void print(const Value* P) { std::cerr << *P; }
static void print(const Value* P) { llvm_cerr << *P; }
};
template <typename T>
@ -59,15 +59,15 @@ namespace {
assert(Cache == 0 && "No value should be cached anymore!");
if (!Ts.empty()) {
std::cerr
llvm_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";
llvm_cerr << "\t";
PrinterTrait<T>::print(*I);
std::cerr << "\n";
llvm_cerr << "\n";
}
std::cerr << '\n';
llvm_cerr << '\n';
return true;
}
@ -123,8 +123,8 @@ void LeakDetector::checkForGarbageImpl(const std::string &Message) {
// use non-short-circuit version so that both checks are performed
if (getObjects().hasGarbage(Message) |
getLLVMObjects().hasGarbage(Message))
std::cerr << "\nThis is probably because you removed an object, but didn't "
"delete it. Please check your code for memory leaks.\n";
llvm_cerr << "\nThis is probably because you removed an object, but didn't "
<< "delete it. Please check your code for memory leaks.\n";
// Clear out results so we don't get duplicate warnings on
// next call...

View File

@ -15,10 +15,9 @@
#include "llvm/PassManager.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Support/Streams.h"
#include <vector>
#include <map>
#include <iostream>
using namespace llvm;
namespace llvm {
@ -443,7 +442,7 @@ bool FunctionPassManager_New::runOnModule(Module &M) {
bool FunctionPassManager_New::run(Function &F) {
std::string errstr;
if (MP->materializeFunction(&F, &errstr)) {
std::cerr << "Error reading bytecode file: " << errstr << "\n";
llvm_cerr << "Error reading bytecode file: " << errstr << "\n";
abort();
}
return FPM->runOnFunction(F);

View File

@ -14,9 +14,8 @@
#include "llvm/TypeSymbolTable.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ADT/StringExtras.h"
#include <iostream>
#include "llvm/Support/Streams.h"
#include <algorithm>
using namespace llvm;
#define DEBUG_SYMBOL_TABLE 0
@ -67,7 +66,7 @@ Type* TypeSymbolTable::erase(iterator Entry) {
#if DEBUG_SYMBOL_TABLE
dump();
std::cerr << " Removing Value: " << Result->getName() << "\n";
llvm_cerr << " Removing Value: " << Result->getName() << "\n";
#endif
tmap.erase(Entry);
@ -76,7 +75,7 @@ Type* TypeSymbolTable::erase(iterator Entry) {
// list...
if (Result->isAbstract()) {
#if DEBUG_ABSTYPE
std::cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
llvm_cerr << "Removing abstract type from symtab" << Result->getDescription()<<"\n";
#endif
cast<DerivedType>(Result)->removeAbstractTypeUser(this);
}
@ -96,7 +95,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
#if DEBUG_SYMBOL_TABLE
dump();
std::cerr << " Inserting type: " << UniqueName << ": "
llvm_cerr << " Inserting type: " << UniqueName << ": "
<< T->getDescription() << "\n";
#endif
@ -107,7 +106,7 @@ void TypeSymbolTable::insert(const std::string& Name, const Type* T) {
if (T->isAbstract()) {
cast<DerivedType>(T)->addAbstractTypeUser(this);
#if DEBUG_ABSTYPE
std::cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
llvm_cerr << "Added abstract type to ST: " << T->getDescription() << "\n";
#endif
}
}
@ -153,14 +152,14 @@ void TypeSymbolTable::refineAbstractType(const DerivedType *OldType,
for (iterator I = begin(), E = end(); I != E; ++I) {
if (I->second == (Type*)OldType) { // FIXME when Types aren't const.
#if DEBUG_ABSTYPE
std::cerr << "Removing type " << OldType->getDescription() << "\n";
llvm_cerr << "Removing type " << OldType->getDescription() << "\n";
#endif
OldType->removeAbstractTypeUser(this);
I->second = (Type*)NewType; // TODO FIXME when types aren't const
if (NewType->isAbstract()) {
#if DEBUG_ABSTYPE
std::cerr << "Added type " << NewType->getDescription() << "\n";
llvm_cerr << "Added type " << NewType->getDescription() << "\n";
#endif
cast<DerivedType>(NewType)->addAbstractTypeUser(this);
}
@ -180,13 +179,13 @@ void TypeSymbolTable::typeBecameConcrete(const DerivedType *AbsTy) {
}
static void DumpTypes(const std::pair<const std::string, const Type*>& T ) {
std::cerr << " '" << T.first << "' = ";
llvm_cerr << " '" << T.first << "' = ";
T.second->dump();
std::cerr << "\n";
llvm_cerr << "\n";
}
void TypeSymbolTable::dump() const {
std::cerr << "TypeSymbolPlane: ";
llvm_cerr << "TypeSymbolPlane: ";
for_each(tmap.begin(), tmap.end(), DumpTypes);
}

View File

@ -55,11 +55,11 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Support/CFG.h"
#include "llvm/Support/InstVisitor.h"
#include "llvm/Support/Streams.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cstdarg>
using namespace llvm;
@ -156,11 +156,11 @@ namespace { // Anonymous namespace for class
switch (action) {
case AbortProcessAction:
msgs << "compilation aborted!\n";
std::cerr << msgs.str();
llvm_cerr << msgs.str();
abort();
case PrintMessageAction:
msgs << "verification continues.\n";
std::cerr << msgs.str();
llvm_cerr << msgs.str();
return false;
case ReturnStatusAction:
msgs << "compilation terminated.\n";