summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-28 21:05:51 +0000
committerChris Lattner <sabre@nondot.org>2009-02-28 21:05:51 +0000
commitc287137ce7455c63be0075e0d5aba0bab4f125ea (patch)
treedac71886746d2c3f34cd1ca2ebadfbeb1b71865d /lib
parent534361e7e17b34c6ac043a2c8bea626a5e9f1657 (diff)
downloadllvm-c287137ce7455c63be0075e0d5aba0bab4f125ea.tar.gz
llvm-c287137ce7455c63be0075e0d5aba0bab4f125ea.tar.bz2
llvm-c287137ce7455c63be0075e0d5aba0bab4f125ea.tar.xz
Change WriteTypeSymbolic to not put a space out before types, also, remove
the old std::ostream version. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp11
-rw-r--r--lib/VMCore/AsmWriter.cpp24
-rw-r--r--lib/VMCore/Verifier.cpp7
3 files changed, 18 insertions, 24 deletions
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index 88a180ae52..920ee37455 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -19,6 +19,7 @@
#include "llvm/Module.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Support/InstIterator.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
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
// symbol table from the module.
//
-void FindUsedTypes::print(std::ostream &o, const Module *M) const {
- o << "Types in use by this module:\n";
+void FindUsedTypes::print(std::ostream &OS, const Module *M) const {
+ raw_os_ostream RO(OS);
+ RO << "Types in use by this module:\n";
for (std::set<const Type *>::const_iterator I = UsedTypes.begin(),
E = UsedTypes.end(); I != E; ++I) {
- WriteTypeSymbolic(o << " ", *I, M);
- o << "\n";
+ RO << " ";
+ WriteTypeSymbolic(RO, *I, M);
+ RO << '\n';
}
}
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 7a4dcbce80..bd3f0b7df9 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -259,7 +259,7 @@ void TypePrinting::CalcTypeName(const Type *Ty,
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<ArrayType>(Ty);
- Result << "[" << ATy->getNumElements() << " x ";
+ Result << '[' << ATy->getNumElements() << " x ";
CalcTypeName(ATy->getElementType(), TypeStack, Result);
Result << ']';
break;
@@ -307,8 +307,6 @@ void TypePrinting::print(const Type *Ty) {
std::string TypeName;
raw_string_ostream TypeOS(TypeName);
-
-
CalcTypeName(Ty, TypeStack, TypeOS);
OS << TypeOS.str();
@@ -340,23 +338,12 @@ void TypePrinting::printAtLeastOneLevel(const Type *Ty) {
/// 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 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){
- // FIXME: Remove this space.
- Out << ' ';
-
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
//===----------------------------------------------------------------------===//
@@ -1713,9 +1700,6 @@ void Value::print(std::ostream &O, AssemblyAnnotationWriter *AAW) const {
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.
// This one uses type names from the given context module
void Type::dump(const Module *Context) const {
WriteTypeSymbolic(errs(), this, Context);
@@ -1723,6 +1707,10 @@ void Type::dump(const Module *Context) const {
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.
void Module::dump() const { print(errs(), 0); errs().flush(); }
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 99a5b92e5f..784a66fa09 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -61,6 +61,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <sstream>
#include <cstdarg>
@@ -290,8 +291,10 @@ namespace {
}
void WriteType(const Type *T) {
- if ( !T ) return;
- WriteTypeSymbolic(msgs, T, Mod );
+ if (!T) return;
+ raw_os_ostream RO(msgs);
+ RO << ' ';
+ WriteTypeSymbolic(RO, T, Mod);
}