[llvm-commits] [llvm] r51705 - in /llvm/trunk: include/llvm/Support/Streams.h lib/Support/Streams.cpp lib/System/Unix/Program.inc lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/CellSPU/SPUInstrInfo.cpp lib/Target/CellSPU/SPURegisterInfo.cpp
Bill Wendling
isanbard at gmail.com
Thu May 29 14:46:33 PDT 2008
Author: void
Date: Thu May 29 16:46:33 2008
New Revision: 51705
URL: http://llvm.org/viewvc/llvm-project?rev=51705&view=rev
Log:
Remove more iostream header includes. Needed to implement a "FlushStream"
function to flush a specified std::ostream.
Modified:
llvm/trunk/include/llvm/Support/Streams.h
llvm/trunk/lib/Support/Streams.cpp
llvm/trunk/lib/System/Unix/Program.inc
llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp
Modified: llvm/trunk/include/llvm/Support/Streams.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Streams.h?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Streams.h (original)
+++ llvm/trunk/include/llvm/Support/Streams.h Thu May 29 16:46:33 2008
@@ -19,6 +19,9 @@
namespace llvm {
+ /// FlushStream - Function called by BaseStream to flush an ostream.
+ void FlushStream(std::ostream &S);
+
/// BaseStream - Acts like the STL streams. It's a wrapper for the std::cerr,
/// std::cout, std::cin, etc. streams. However, it doesn't require #including
/// @verbatim <iostream> @endverbatm in every file (doing so increases static
@@ -39,6 +42,11 @@
return *this;
}
+ void flush() {
+ if (Stream)
+ FlushStream(*Stream);
+ }
+
template <typename Ty>
BaseStream &operator << (const Ty &Thing) {
if (Stream) *Stream << Thing;
Modified: llvm/trunk/lib/Support/Streams.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Streams.cpp?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Streams.cpp (original)
+++ llvm/trunk/lib/Support/Streams.cpp Thu May 29 16:46:33 2008
@@ -19,3 +19,12 @@
OStream llvm::cout(std::cout);
OStream llvm::cerr(std::cerr);
IStream llvm::cin(std::cin);
+
+namespace llvm {
+
+/// FlushStream - Function called by BaseStream to flush an ostream.
+void FlushStream(std::ostream &S) {
+ S << std::flush;
+}
+
+} // end anonymous namespace
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Thu May 29 16:46:33 2008
@@ -17,8 +17,8 @@
//===----------------------------------------------------------------------===//
#include <llvm/Config/config.h>
+#include <llvm/Support/Streams.h>
#include "Unix.h"
-#include <iostream>
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -210,8 +210,8 @@
}
// Make sure stderr and stdout have been flushed
- std::cerr << std::flush;
- std::cout << std::flush;
+ cerr.flush();
+ cout.flush();
fsync(1);
fsync(2);
Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Thu May 29 16:46:33 2008
@@ -31,7 +31,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Compiler.h"
-#include <iostream>
#include <queue>
#include <set>
Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Thu May 29 16:46:33 2008
@@ -17,7 +17,7 @@
#include "SPUTargetMachine.h"
#include "SPUGenInstrInfo.inc"
#include "llvm/CodeGen/MachineInstrBuilder.h"
-#include <iostream>
+#include "llvm/Support/Streams.h"
using namespace llvm;
@@ -218,7 +218,7 @@
BuildMI(MBB, MI, get(SPU::ORv4i32), DestReg).addReg(SrcReg)
.addReg(SrcReg);
} else {
- std::cerr << "Attempt to copy unknown/unsupported register class!\n";
+ cerr << "Attempt to copy unknown/unsupported register class!\n";
abort();
}
}
Modified: llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=51705&r1=51704&r2=51705&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Thu May 29 16:46:33 2008
@@ -40,7 +40,6 @@
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/STLExtras.h"
#include <cstdlib>
-#include <iostream>
using namespace llvm;
@@ -178,7 +177,7 @@
case SPU::R126: return 126;
case SPU::R127: return 127;
default:
- std::cerr << "Unhandled reg in SPURegisterInfo::getRegisterNumbering!\n";
+ cerr << "Unhandled reg in SPURegisterInfo::getRegisterNumbering!\n";
abort();
}
}
More information about the llvm-commits
mailing list