summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Make tool_output_file's raw_ostream instance a member variable insteadDan Gohman2010-09-011-14/+18
| | | | | | | | | | of a base class. This makes it possible to unregister the file from FilesToRemove when the file is done. Also, this eliminates the need for formatted_tool_output_file. llvm-svn: 112706
* Make outs() close its file when its stream is destructed, so thatDan Gohman2010-08-201-2/+4
| | | | | | pending output errors are detected. llvm-svn: 111643
* Delete raw_stdout_ostream and raw_stderr_ostream, which are unusedDan Gohman2010-08-201-12/+4
| | | | | | | outside of outs() and errs() themselves, and they don't really need custom classes. llvm-svn: 111642
* Move raw_ostream's Error flag into raw_fd_ostream, as that's the onlyDan Gohman2010-08-201-16/+17
| | | | | | class which is using it. llvm-svn: 111639
* Introduce a new tool_output_file class, which extends raw_ostream withDan Gohman2010-08-201-0/+28
| | | | | | | | functionality that most command-line tools need: ensuring that the output file gets deleted if the tool is interrupted or encounters an error. llvm-svn: 111595
* Make raw_fd_ostream consider itself the owner of STDOUT_FILENO whenDan Gohman2010-08-181-2/+5
| | | | | | | | | constructed with an output filename of "-". In particular, allow the file descriptor to be closed, and close the file descriptor in the destructor if it hasn't been explicitly closed already, to ensure that any write errors are detected. llvm-svn: 111436
* Revert r111321. This doesn't fix a problem.Dan Gohman2010-08-181-23/+19
| | | | llvm-svn: 111339
* Fix the rest of rdar://8318441 which happens when a raw_fd_ostreamChris Lattner2010-08-171-19/+23
| | | | | | | | | | (e.g. errs()) fails in close() due to (e.g.) a broken pipe. As previously written, the had_error() flag would get set and then the raw_ostream dtor would report a fatal error. There is nothing the client can do about this and we have no way to report the error, so just eat it. llvm-svn: 111321
* avoid undef behavior on minint, fixing PR7783.Chris Lattner2010-08-031-2/+3
| | | | llvm-svn: 110114
* add some triple for minix, patch by Kees van Reeuwijk from PR7582Chris Lattner2010-07-071-1/+1
| | | | llvm-svn: 107785
* Minor code simplification.Dan Gohman2010-05-281-2/+1
| | | | llvm-svn: 104959
* Fix a redundant-return warning.Dan Gohman2010-05-281-1/+2
| | | | llvm-svn: 104958
* Usage of O_NONBLOCK in bjam is now confirmed as a bug and fixed upstream.Dan Gohman2010-05-181-4/+7
| | | | | | Update the comment. llvm-svn: 104021
* Handle the case where open(2) or close(2) is interrupted by a signal whenDan Gohman2010-05-061-11/+24
| | | | | | | | automatic syscall restarting is disabled. Also, fix the build on systems which don't define EWOULDBLOCK. llvm-svn: 103158
* Handle EWOULDBLOCK as EAGAIN. And add a comment explaining whyDan Gohman2010-05-061-3/+22
| | | | | | | | | EAGAIN and EWOULDBLOCK are used here. Also, handle the case where a write call is interrupted after some data has already been written. llvm-svn: 103153
* Try again if write(2) reports an recoverable error.Benjamin Kramer2010-05-051-1/+6
| | | | | | | This should fix mysteriously crashing boost regression tests when stderr is managed by bjam (PR7043). llvm-svn: 103085
* add minix support, patch by Kees van Reeuwijk! PR6797Chris Lattner2010-04-091-1/+2
| | | | llvm-svn: 100895
* rename llvm::llvm_report_error -> llvm::report_fatal_errorChris Lattner2010-04-071-2/+2
| | | | llvm-svn: 100709
* Fix minor style issues.Dan Gohman2010-03-241-23/+23
| | | | llvm-svn: 99414
* add an assertion requested on llvmdev.Chris Lattner2010-03-051-0/+1
| | | | llvm-svn: 97769
* enhance raw_svector_ostream::write_impl to work with unbuffered streams,Chris Lattner2010-02-151-6/+12
| | | | | | which may call write_impl on things that are not the usual buffer. llvm-svn: 96209
* Fix MSVC build.Benjamin Kramer2010-01-291-0/+1
| | | | llvm-svn: 94809
* Use llvm::format instead of ftostr (which just calls sprintf).Benjamin Kramer2010-01-291-2/+1
| | | | llvm-svn: 94807
* Changes to fix buffering that I forgot to commit with previous patch.Chris Lattner2010-01-221-5/+8
| | | | llvm-svn: 94222
* add a new MCAsmStreamer::GetCommentOS method to simplify stuffChris Lattner2010-01-221-0/+8
| | | | | | that doesn't want to use twines. llvm-svn: 94199
* Make some methods const. The only interesting change here is thatChris Lattner2009-12-191-14/+16
| | | | | | | | it changes raw_fd_ostream::preferred_buffer_size to return zero on a scary stat failure instead of setting the stream to an error state. This method really should not mutate the stream. llvm-svn: 91740
* Micro-optimize these functions in the case where they are not inlined.Dan Gohman2009-12-141-2/+1
| | | | llvm-svn: 91316
* Add raw_ostream::write_escaped, for writing escaped strings.Daniel Dunbar2009-10-171-0/+34
| | | | llvm-svn: 84355
* Drop the raw_ostream required buffer size to 1.Daniel Dunbar2009-09-151-2/+2
| | | | | | | - As best I can tell, we have eliminated all the code which used to require a larger buffer size. llvm-svn: 81912
* Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn'tDan Gohman2009-09-111-0/+4
| | | | | | | | | | | | | | | working. To support this, add an is_displayed() function to raw_ostream, and generalize Process::StandardOutIsDisplayed and friends in order to support it. Also, call RemoveFileOnSignal before creating a file instead of after, so that the file isn't left behind if the program is interrupted between when the file is created and RemoveFileOnSignal is called. While here, add a -S to llvm-extract and port it to IRReader so that it supports assembly input. llvm-svn: 81568
* Make LLVM command-line tools overwrite their output files without -f.Dan Gohman2009-08-251-6/+6
| | | | | | | | | | | | | | | | This is conventional command-line tool behavior. -f now just means "enable binary output on terminals". Add a -f option to llvm-extract and llvm-link, for consistency. Remove F_Force from raw_fd_ostream and enable overwriting and truncating by default. Introduce an F_Excl flag to permit users to enable a failure when the file already exists. This flag is currently unused. Update Makefiles and documentation accordingly. llvm-svn: 79990
* Correctly account for the Spaces array nul terminator. Thanks Chris!Dan Gohman2009-08-241-2/+3
| | | | llvm-svn: 79894
* raw_ostream::indent is used for PadToColumn which often prints moreDan Gohman2009-08-241-3/+6
| | | | | | than 16 spaces. Make the Spaces array wide enough to handle common cases. llvm-svn: 79890
* split raw_os_ostream out to its own header and implementation file. ThisChris Lattner2009-08-241-14/+0
| | | | | | | means that raw_ostream no longer has to #include <iosfwd>. Nothing in llvm should use raw_os_ostream.h, but llvm-gcc and some unit tests do. llvm-svn: 79886
* prune the #includes in raw_ostream.h by moving a Chris Lattner2009-08-241-0/+8
| | | | | | | member out of line. ftostr is not particularly speedy, so that method is presumably not perf sensitive. llvm-svn: 79885
* Fix off-by-one in llvm::Format::print.Daniel Dunbar2009-08-231-5/+5
| | | | | | | | | | | | | - This also shortens the Format.h implementation, and uses the print buffer fully (it was wasting a character). - This manifested as llvm-test failures, because one side effect was that raw_ostream would write garbage '\x00' values into the output stream if it happened that the string was at the end of the buffer. This meant that grep would report 'Binary file matches', which meant the silly pattern matching llvm-test eventually does would fail. Cute. :) llvm-svn: 79862
* Fix windows build.Benjamin Kramer2009-08-231-1/+1
| | | | llvm-svn: 79845
* Change raw_fd_ostream to take flags as an optional bitmask Chris Lattner2009-08-231-14/+24
| | | | | | | | | | | | | | | | instead of as two bools. Use this to add a F_Append flag which has the obvious behavior. Other unrelated changes conflated into this patch: 1. REmove EH stuff from llvm-dis and llvm-as, the try blocks are dead. 2. Simplify the filename inference code in llvm-as/llvm-dis, because raw_fd_ostream does the right thing with '-'. 3. Switch machine verifier to use raw_ostream instead of ostream (Which is the thing that needed append in the first place). llvm-svn: 79807
* add a raw_ostream::indent method, to be used like:Chris Lattner2009-08-221-0/+17
| | | | | | | | OS.indent(i) << "whatever"; people seem to like indenting things ;-) llvm-svn: 79784
* Change raw_svector_ostream to reserve the input buffer if necessary, Ted wasDaniel Dunbar2009-08-191-3/+7
| | | | | | | | | | | | | right. - This class turns out to be much more convenient to use if we do this; clients can make sure the buffer is always big enough if they care (since our current idiom tends to be to use a SmallString<256> for the input to this we should generally be avoiding an unnecessary malloc). Also, add a convenience raw_svector_ostream::str method which flushes the buffer and returns a StringRef for the vector contents. llvm-svn: 79446
* Switch raw_svector_ostream to use the vector as the ostream buffer.Daniel Dunbar2009-08-191-1/+29
| | | | | | | - This avoids unnecessary malloc/free overhead in the common case, and unnecessary copying from the ostream buffer into the output vector. llvm-svn: 79434
* Speculatively revert r79375, which may be breaking bootstrap, although in aDaniel Dunbar2009-08-191-15/+10
| | | | | | rather obscure way (the other candidate is r79377). llvm-svn: 79426
* raw_ostream: Simplify write(unsigned char) to match write(const char*, ↵Daniel Dunbar2009-08-191-18/+8
| | | | | | unsigned). llvm-svn: 79386
* raw_ostream: Remove pointless redefinitions of tell().Daniel Dunbar2009-08-191-8/+0
| | | | | | - The base class implementation is correct. llvm-svn: 79385
* raw_ostream: Add the capability for subclasses to manually install an externalDaniel Dunbar2009-08-181-21/+23
| | | | | | buffer. llvm-svn: 79382
* Speed up raw_ostream::<<(unsigned long long) for 32-bit systems by doing mostDaniel Dunbar2009-08-181-10/+15
| | | | | | div/mods in 32-bits. llvm-svn: 79375
* Fix a bug in raw_ostream::write(char) introduced by the change toDan Gohman2009-08-181-3/+10
| | | | | | | | | allow underlying stream classes to decline buffering. After calling SetBuffered(), re-check whether the stream is Unbuffered in order to handle the case where the underlying stream has declined buffering. llvm-svn: 79362
* Revert r78924, disabling buffering defeats all the fast paths in raw_ostream.Daniel Dunbar2009-08-181-0/+12
| | | | llvm-svn: 79361
* Mingw also doesn't have st_blksize.Dan Gohman2009-08-151-1/+1
| | | | llvm-svn: 79142
* Always check to see if raw_fd_ostream's file descriptor is attached toDan Gohman2009-08-151-13/+16
| | | | | | a terminal, not just when it's STDOUT_FILENO. llvm-svn: 79066
OpenPOWER on IntegriCloud