[LLVMdev] #include <iostream>

John Criswell criswell at cs.uiuc.edu
Mon Dec 11 11:18:59 PST 2006


Bill Wendling wrote:

It seems that when compiling Debug versions of LLVM, we use stream
manipulators (like std::hex) on the new LLVM streams, and doing so
causes a compiler error when compiling LLVM with GCC 3.4.0.

I commited a fix to work around the problem, but it seems to me it would
be better if LLVM streams could support common stream manipulators.

First, has anyone else experienced the compiler error I ran into?  And
second, is there any easy way to get LLVM streams to work with standard
stream manipulators?

-- John T.

> 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
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>   




More information about the llvm-dev mailing list