summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/raw_ostream.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* When standard output is a terminal, set outs() to be unbuffered, toDan Gohman2009-08-131-1/+11
| | | | | | | | mimic the behavior of stdtout, which is line-buffered when the output is a terminal. This fixes some issues with bugpoint output appearing being printed out of order. llvm-svn: 78953
* Fix a compiler warning about comparing signed with unsigned.Dan Gohman2009-08-131-1/+1
| | | | llvm-svn: 78933
* Add an assert to check copy_to_buffer's precondition.Dan Gohman2009-08-131-0/+2
| | | | llvm-svn: 78926
* Set raw_os_ostream, raw_string_ostream, and raw_svector_ostream to beDan Gohman2009-08-131-12/+0
| | | | | | | | unbuffered. std::ostream does its own buffering, and std::string and SmallVector both have allocation strategies intended to handle frequent appending. llvm-svn: 78924
* Add support to raw_ostream for sizing the buffer according to theDan Gohman2009-08-131-2/+25
| | | | | | | needs of the underlying output mechanism. raw_fd_ostream now uses st_blksize from fstat to determine a buffer size. llvm-svn: 78923
* Move SetBufferSize and SetUnbuffered out of line.Dan Gohman2009-08-131-0/+20
| | | | llvm-svn: 78909
* Fix the buffer handling logic so that write_impl is always called withDan Gohman2009-08-131-20/+25
| | | | | | | a full buffer, rather than often being called with a slightly-less-than-full buffer. llvm-svn: 78907
* Add raw_ostream::write_hexDaniel Dunbar2009-07-301-4/+7
| | | | llvm-svn: 77614
* Perform simplification noticed by Reid.Daniel Dunbar2009-07-291-4/+0
| | | | llvm-svn: 77477
* raw_ostream: Follow the 32-bit path when printing "small" decimal numbers.Daniel Dunbar2009-07-291-0/+4
| | | | llvm-svn: 77444
* Make raw_null_ostream flush its buffer in its destructor, so thatDan Gohman2009-07-271-0/+9
| | | | | | | it conforms to the assertion added in r77245. This fixes a failure in qa_override.c in clang's testsuite. llvm-svn: 77255
* Add an assertion check to raw_ostream's destructor to verifyDan Gohman2009-07-271-0/+5
| | | | | | that the subclass hasn't left any pending data in the buffer. llvm-svn: 77245
* Add raw_null_ostream and llvm::nulls(), a raw_ostream that discards output.Daniel Dunbar2009-07-161-0/+17
| | | | | | - No functionality change. llvm-svn: 76103
* Use size_t.Dan Gohman2009-07-161-12/+12
| | | | llvm-svn: 76069
* Change raw_ostream so that it doesn't call llvm_report_errorDan Gohman2009-07-151-4/+14
| | | | | | | | | | | | | | | | | | immediately on every output error. Instead, add a flag to raw_ostream, and set the flag whenever an error is detected. The flag can be queried and cleared from the public API. This gives applications more flexibility to handling errors in application-specific ways. If the flag is not cleared when the raw_ostream is destructed, llvm_report_error is called from the destructor. This ensures that errors are not implicitly silenced, and provides convenient default behavior for tools like llc and opt. Clients wishing to avoid llvm_report_error calls from raw_ostream should check for errors and clear the error flag. llvm-svn: 75857
* Add a Force option to raw_fd_ostream to specify whether openingDan Gohman2009-07-151-1/+3
| | | | | | | | an existing file is considered an error. Convert several tools to use raw_fd_ostream instead of std::ostream, and to use this new option instead of doing a manual check. llvm-svn: 75801
* Check for errors on close(2) too. And lseek(2).Dan Gohman2009-07-151-2/+6
| | | | llvm-svn: 75793
* Use 0664 instead of 0644 for the default open mode. This isDan Gohman2009-07-151-1/+1
| | | | | | | consistent with common std::ostream implmentations, and it gives the user the option of using the umask group write bit. llvm-svn: 75792
* Detect write failures on raw_fd_ostream.Daniel Dunbar2009-07-151-2/+4
| | | | llvm-svn: 75758
* Have asm printers use formatted_raw_ostream directly to avoid aDavid Greene2009-07-141-1/+1
| | | | | | dynamic_cast<>. llvm-svn: 75670
* Make changes suggested by Chris and eliminate newly-added raw_ostreamDavid Greene2009-07-101-1/+0
| | | | | | | | | hooks as they're no longer needed. The major change with this patch is to make formatted_raw_ostream usable by any client of raw_ostream. llvm-svn: 75283
* Add some hooks that a redesigned AsmStream needs to do its job. TheseDavid Greene2009-07-091-0/+1
| | | | | | allow derived classes to examine the stream buffer before it's flushed. llvm-svn: 75199
* Add support for outputting ANSI colors to raw_fd_ostream.Torok Edwin2009-06-041-0/+30
| | | | llvm-svn: 72854
* Make all raw_ostreams support the tell() function.Douglas Gregor2009-04-201-0/+11
| | | | llvm-svn: 69583
* Add BUILTIN_EXPECT Support/Compiler macro.Daniel Dunbar2009-03-171-1/+2
| | | | | | | | | - Use for exceptional buffer conditions in raw_ostream:write to shave off a cycle or two. - Please rename if you have a better one. llvm-svn: 67103
* raw_ostream: Put all exceptional conditions in raw_ostream::writeDaniel Dunbar2009-03-171-18/+30
| | | | | | | | under a single branch. Also, add a FIXME for formatted output. llvm-svn: 67069
* raw_ostream: Rework implementation of unbuffered streams so outputtingDaniel Dunbar2009-03-171-4/+12
| | | | | | | | | a single character requires only one branch to follow slow path. - Never use a buffer when writing on an unbuffered stream. - Move default buffer size to header. llvm-svn: 67066
* raw_ostream: Replace flush_impl with write_impl, which takes data toDaniel Dunbar2009-03-161-32/+15
| | | | | | | | | write as arguments. - Add raw_ostream::GetNumBytesInBuffer. - Privatize buffer pointers. - Get rid of slow and unnecessary code for writing out large strings. llvm-svn: 67060
* raw_ostream: Lift out flush_nonempty.Daniel Dunbar2009-03-161-20/+21
| | | | | | | | | | | | | | | | | - Flush a known non-empty buffers; enforces the interface to flush_impl and kills off HandleFlush (which I saw no reason to be an inline method, Chris?). - Clarify invariant that flush_impl is only called with OutBufCur > OutBufStart. - This also cleary collects all places where we have to deal with the buffer possibly not existing. - A few more comments and fixing the unbuffered behavior remain in this commit sequence. llvm-svn: 67057
* Make raw_ostream::operator<<(const void *) fast; it doesn't matter butDaniel Dunbar2009-03-161-2/+19
| | | | | | it is easy. llvm-svn: 67054
* Add slow path for single character write, and use exclusively forDaniel Dunbar2009-03-161-8/+8
| | | | | | single characters writes outside of the fast path in raw_ostream.h llvm-svn: 67053
* PR3478: raw_ostream should not buffer stderrDaniel Dunbar2009-03-101-1/+5
| | | | | | | - Add unbuffered flag to raw_ostream, forwarded by raw_fd_ostream and used by raw_stderr_ostream. llvm-svn: 66545
* Add method raw_fd_ostream::seek() for random access within a file.Ted Kremenek2009-01-261-0/+6
| | | | llvm-svn: 63044
* Have raw_fd_ostream keep track of the position in the file to make tell() go ↵Ted Kremenek2008-12-041-10/+4
| | | | | | faster by not requiring a flush(). llvm-svn: 60560
OpenPOWER on IntegriCloud