[LLVMdev] #include <iostream>

Bill Wendling wendling at apple.com
Thu Dec 7 14:32:04 PST 2006


Hi all,

With the newest patches to LLVM, there should be no reason for having  
"#include <iostream>" in any library source code file, except for lib/ 
Support/Streams.cpp. Please use the following instead:

OLD                NEW
---                ---
std::ostream       llvm::OStream
std::istream       llvm::IStream
std::cerr          llvm::cerr
std::cerr          llvm::cout
std::cin           llvm::cin
DEBUG(std::cerr    DOUT

If you have something like this:

	void print(std::ostream& O);

You can pass the LLVM streams in like this:

	print(*cerr.stream());

Or you can change the print() method to take an llvm ostream:

	void print(llvm::OStream& O);

	print(cerr);

-bw




More information about the llvm-dev mailing list