[llvm-commits] [llvm] r57989 - in /llvm/trunk: include/llvm/Bitcode/ReaderWriter.h lib/Bitcode/Writer/BitcodeWriter.cpp lib/Bitcode/Writer/BitcodeWriterPass.cpp

Julien Lerouge jlerouge at apple.com
Thu Oct 23 09:22:19 PDT 2008


On Wed, Oct 22, 2008 at 05:39:14PM +0000, Daniel Dunbar wrote:
> ...
>
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Oct 22 12:39:14 2008
> @@ -1356,7 +1364,7 @@
>  
>    
>    // If writing to stdout, set binary mode.
> -  if (llvm::cout == Out)
> +  if (&llvm::outs() == &Out)
>      sys::Program::ChangeStdoutToBinary();
>  
>    // Write the generated bitstream to "Out".
> 
> ...
>

This breaks stdout output on MingW if using the old WriteBitcodeToFile
API. In that case, the test doesn't work because it's comparing the
address of the raw_stdout_ostream static with the address of a local
object (allocated in the older API). 

In the older API, can you add a test for cout and return the same static
if writing to stdout ? Or directly call ChangeStdoutToBinary in the
older API if llvm::cout == Out ?

Thanks,
Julien

MW $ llvm-as -f foo.ll > foo.bc
MW $ llvm-dis -f foo.bc
C:\llvm\bin\llvm-dis: Invalid bitcode signature
MW $

but:

MW $ llvm-as -f foo.ll -o foo.bc
MW $ llvm-dis -f foo.bc
MW $

-- 
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com



More information about the llvm-commits mailing list