[llvm-commits] [llvm] r65720 - in /llvm/trunk: include/llvm/Assembly/Writer.h lib/Analysis/IPA/FindUsedTypes.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Verifier.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 28 13:05:52 PST 2009
Author: lattner
Date: Sat Feb 28 15:05:51 2009
New Revision: 65720
URL: http://llvm.org/viewvc/llvm-project?rev=65720&view=rev
Log:
Change WriteTypeSymbolic to not put a space out before types, also, remove
the old std::ostream version.
Modified:
llvm/trunk/include/llvm/Assembly/Writer.h
llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
Modified: llvm/trunk/include/llvm/Assembly/Writer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Assembly/Writer.h?rev=65720&r1=65719&r2=65720&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Assembly/Writer.h (original)
+++ llvm/trunk/include/llvm/Assembly/Writer.h Sat Feb 28 15:05:51 2009
@@ -27,10 +27,9 @@
class raw_ostream;
// 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 or one of its component types. This is slower than a simple x << Type;
+// type, if there is an entry in the Module's symbol table for the specified
+// 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);
// WriteAsOperand - Write the name of the specified value out to the specified
Modified: llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp?rev=65720&r1=65719&r2=65720&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/FindUsedTypes.cpp Sat Feb 28 15:05:51 2009
@@ -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 @@
// 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';
}
}
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=65720&r1=65719&r2=65720&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Sat Feb 28 15:05:51 2009
@@ -259,7 +259,7 @@
}
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 @@
std::string TypeName;
raw_string_ostream TypeOS(TypeName);
-
-
CalcTypeName(Ty, TypeStack, TypeOS);
OS << TypeOS.str();
@@ -340,23 +338,12 @@
/// 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::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 @@
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(); }
Modified: llvm/trunk/lib/VMCore/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=65720&r1=65719&r2=65720&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Verifier.cpp (original)
+++ llvm/trunk/lib/VMCore/Verifier.cpp Sat Feb 28 15:05:51 2009
@@ -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 @@
}
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);
}
More information about the llvm-commits
mailing list