mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 12:41:49 +01:00
Change WriteTypeSymbolic to not put a space out before types, also, remove
the old std::ostream version. llvm-svn: 65720
This commit is contained in:
parent
9e0c90d568
commit
f47615197e
@ -27,10 +27,9 @@ class Value;
|
|||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
|
|
||||||
// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
|
// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
|
||||||
// type, iff there is an entry in the Module's symbol table for the specified
|
// type, if there is an entry in the Module's symbol table for the specified
|
||||||
// type or one of its component types. This is slower than a simple x << Type;
|
// type or one of its component types.
|
||||||
//
|
//
|
||||||
void WriteTypeSymbolic(std::ostream &, const Type *, const Module *M);
|
|
||||||
void WriteTypeSymbolic(raw_ostream &, const Type *, const Module *M);
|
void WriteTypeSymbolic(raw_ostream &, const Type *, const Module *M);
|
||||||
|
|
||||||
// WriteAsOperand - Write the name of the specified value out to the specified
|
// WriteAsOperand - Write the name of the specified value out to the specified
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
char FindUsedTypes::ID = 0;
|
char FindUsedTypes::ID = 0;
|
||||||
@ -91,11 +92,13 @@ bool FindUsedTypes::runOnModule(Module &m) {
|
|||||||
// passed in, then the types are printed symbolically if possible, using the
|
// passed in, then the types are printed symbolically if possible, using the
|
||||||
// symbol table from the module.
|
// symbol table from the module.
|
||||||
//
|
//
|
||||||
void FindUsedTypes::print(std::ostream &o, const Module *M) const {
|
void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
|
||||||
o << "Types in use by this module:\n";
|
raw_os_ostream RO(OS);
|
||||||
|
RO << "Types in use by this module:\n";
|
||||||
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
|
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
|
||||||
E = UsedTypes.end(); I != E; ++I) {
|
E = UsedTypes.end(); I != E; ++I) {
|
||||||
WriteTypeSymbolic(o << " ", *I, M);
|
RO << " ";
|
||||||
o << "\n";
|
WriteTypeSymbolic(RO, *I, M);
|
||||||
|
RO << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ void TypePrinting::CalcTypeName(const Type *Ty,
|
|||||||
}
|
}
|
||||||
case Type::ArrayTyID: {
|
case Type::ArrayTyID: {
|
||||||
const ArrayType *ATy = cast<ArrayType>(Ty);
|
const ArrayType *ATy = cast<ArrayType>(Ty);
|
||||||
Result << "[" << ATy->getNumElements() << " x ";
|
Result << '[' << ATy->getNumElements() << " x ";
|
||||||
CalcTypeName(ATy->getElementType(), TypeStack, Result);
|
CalcTypeName(ATy->getElementType(), TypeStack, Result);
|
||||||
Result << ']';
|
Result << ']';
|
||||||
break;
|
break;
|
||||||
@ -307,8 +307,6 @@ void TypePrinting::print(const Type *Ty) {
|
|||||||
std::string TypeName;
|
std::string TypeName;
|
||||||
|
|
||||||
raw_string_ostream TypeOS(TypeName);
|
raw_string_ostream TypeOS(TypeName);
|
||||||
|
|
||||||
|
|
||||||
CalcTypeName(Ty, TypeStack, TypeOS);
|
CalcTypeName(Ty, TypeStack, TypeOS);
|
||||||
OS << TypeOS.str();
|
OS << TypeOS.str();
|
||||||
|
|
||||||
@ -340,23 +338,12 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty) {
|
|||||||
|
|
||||||
/// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
|
/// WriteTypeSymbolic - This attempts to write the specified type as a symbolic
|
||||||
/// type, iff there is an entry in the modules symbol table for the specified
|
/// type, iff there is an entry in the modules symbol table for the specified
|
||||||
/// type or one of it's component types. This is slower than a simple x << Type
|
/// type or one of it's component types.
|
||||||
///
|
///
|
||||||
void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){
|
void llvm::WriteTypeSymbolic(raw_ostream &Out, const Type *Ty, const Module *M){
|
||||||
// FIXME: Remove this space.
|
|
||||||
Out << ' ';
|
|
||||||
|
|
||||||
TypePrinting(M, Out).print(Ty);
|
TypePrinting(M, Out).print(Ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
// std::ostream adaptor.
|
|
||||||
void llvm::WriteTypeSymbolic(std::ostream &Out, const Type *Ty,
|
|
||||||
const Module *M) {
|
|
||||||
raw_os_ostream RO(Out);
|
|
||||||
WriteTypeSymbolic(RO, Ty, M);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// SlotTracker Class: Enumerate slot numbers for unnamed values
|
// SlotTracker Class: Enumerate slot numbers for unnamed values
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
@ -1712,9 +1699,6 @@ void Value::print(std::ostream &O, AssemblyAnnotationWriter *AAW) const {
|
|||||||
// Value::dump - allow easy printing of Values from the debugger.
|
// Value::dump - allow easy printing of Values from the debugger.
|
||||||
void Value::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
|
void Value::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
|
||||||
|
|
||||||
// Type::dump - allow easy printing of Types from the debugger.
|
|
||||||
void Type::dump() const { print(errs()); errs() << '\n'; errs().flush(); }
|
|
||||||
|
|
||||||
// Type::dump - allow easy printing of Types from the debugger.
|
// Type::dump - allow easy printing of Types from the debugger.
|
||||||
// This one uses type names from the given context module
|
// This one uses type names from the given context module
|
||||||
void Type::dump(const Module *Context) const {
|
void Type::dump(const Module *Context) const {
|
||||||
@ -1723,6 +1707,10 @@ void Type::dump(const Module *Context) const {
|
|||||||
errs().flush();
|
errs().flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Type::dump - allow easy printing of Types from the debugger.
|
||||||
|
void Type::dump() const { dump(0); }
|
||||||
|
|
||||||
|
|
||||||
// Module::dump() - Allow printing of Modules from the debugger.
|
// Module::dump() - Allow printing of Modules from the debugger.
|
||||||
void Module::dump() const { print(errs(), 0); errs().flush(); }
|
void Module::dump() const { print(errs(), 0); errs().flush(); }
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/Support/Compiler.h"
|
#include "llvm/Support/Compiler.h"
|
||||||
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
@ -290,8 +291,10 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void WriteType(const Type *T) {
|
void WriteType(const Type *T) {
|
||||||
if ( !T ) return;
|
if (!T) return;
|
||||||
WriteTypeSymbolic(msgs, T, Mod );
|
raw_os_ostream RO(msgs);
|
||||||
|
RO << ' ';
|
||||||
|
WriteTypeSymbolic(RO, T, Mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user