aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/raw_ostream.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add raw_null_ostream and llvm::nulls(), a raw_ostream that discards output.Daniel Dunbar2009-07-161-0/+17
| | | | | | | - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76103 91177308-0d34-0410-b5e6-96231b3b80d8
* Use size_t.Dan Gohman2009-07-161-12/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76069 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75857 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75801 91177308-0d34-0410-b5e6-96231b3b80d8
* Check for errors on close(2) too. And lseek(2).Dan Gohman2009-07-151-2/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75793 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75792 91177308-0d34-0410-b5e6-96231b3b80d8
* Detect write failures on raw_fd_ostream.Daniel Dunbar2009-07-151-2/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75758 91177308-0d34-0410-b5e6-96231b3b80d8
* Have asm printers use formatted_raw_ostream directly to avoid aDavid Greene2009-07-141-1/+1
| | | | | | | dynamic_cast<>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75670 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75283 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75199 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for outputting ANSI colors to raw_fd_ostream.Edwin Török2009-06-041-0/+30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72854 91177308-0d34-0410-b5e6-96231b3b80d8
* Make all raw_ostreams support the tell() function.Douglas Gregor2009-04-201-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69583 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67103 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67069 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67066 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67060 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67057 91177308-0d34-0410-b5e6-96231b3b80d8
* Make raw_ostream::operator<<(const void *) fast; it doesn't matter butDaniel Dunbar2009-03-161-2/+19
| | | | | | | it is easy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67054 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67053 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66545 91177308-0d34-0410-b5e6-96231b3b80d8
* Add method raw_fd_ostream::seek() for random access within a file.Ted Kremenek2009-01-261-0/+6
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63044 91177308-0d34-0410-b5e6-96231b3b80d8
* 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(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60560 91177308-0d34-0410-b5e6-96231b3b80d8
* Add 'tell' method to raw_fd_ostream that clients can use to query the ↵Ted Kremenek2008-11-261-0/+8
| | | | | | current location in the file the stream is writing to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60085 91177308-0d34-0410-b5e6-96231b3b80d8
* Add Binary flag to raw_fd_ostream constructor.Daniel Dunbar2008-11-131-2/+13
| | | | | | | Document raw_fd_ostream's treatment of "-". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59219 91177308-0d34-0410-b5e6-96231b3b80d8
* fix PR2953, an off-by-one error handling formatted i/o. Chris Lattner2008-10-261-1/+1
| | | | | | | Thanks to Török Edwin for the awesome reduced testcase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58199 91177308-0d34-0410-b5e6-96231b3b80d8
* Added raw_fd_ostream::close().Ted Kremenek2008-10-231-3/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58052 91177308-0d34-0410-b5e6-96231b3b80d8
* Clear raw_fd_ostream error string on success and explain behavior inDaniel Dunbar2008-10-211-3/+6
| | | | | | | | | documentation. Add C++ header marker. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57923 91177308-0d34-0410-b5e6-96231b3b80d8
* Updating VC++ project.Cédric Venet2008-08-241-0/+1
| | | | | | Adding one include file and correct one declaration from class to struct in order to make llvm compile on VC2005. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55279 91177308-0d34-0410-b5e6-96231b3b80d8
* Add raw_stream adaptors that write into an std::string and ↵Chris Lattner2008-08-231-0/+35
| | | | | | SmallVector/SmallString. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55265 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch the asmprinter (.ll) and all the stuff it requires over toChris Lattner2008-08-231-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | use raw_ostream instead of std::ostream. Among other goodness, this speeds up llvm-dis of kc++ with a release build from 0.85s to 0.49s (88% faster). Other interesting changes: 1) This makes Value::print be non-virtual. 2) AP[S]Int and ConstantRange can no longer print to ostream directly, use raw_ostream instead. 3) This fixes a bug in raw_os_ostream where it didn't flush itself when destroyed. 4) This adds a new SDNode::print method, instead of only allowing "dump". A lot of APIs have both std::ostream and raw_ostream versions, it would be useful to go through and systematically anihilate the std::ostream versions. This passes dejagnu, but there may be minor fallout, plz let me know if so and I'll fix it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55263 91177308-0d34-0410-b5e6-96231b3b80d8
* add #includeChris Lattner2008-08-231-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55252 91177308-0d34-0410-b5e6-96231b3b80d8
* add a simple mechanism for formatted output. This gives raw_ostream's Chris Lattner2008-08-231-0/+50
| | | | | | | | | | all the power and risk of fprintf format strings. Use them like this: OS << format("%10.4f", 42.0) << "\n" << format("%x", 42) << '\n'; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55246 91177308-0d34-0410-b5e6-96231b3b80d8
* improve support for systems that need unistd.h to get STDOUT_FILENO.Chris Lattner2008-08-221-2/+10
| | | | | | | Patch contributed by Bjorn Reese! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55179 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix write() when the string being written is larger than the buffer. This ↵Owen Anderson2008-08-211-0/+1
| | | | | | | | | broke various ObjC testcases with very long symbol names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55148 91177308-0d34-0410-b5e6-96231b3b80d8
* Move non-trivial methods out of line to avoid code-size bloat.Owen Anderson2008-08-211-0/+92
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55138 91177308-0d34-0410-b5e6-96231b3b80d8
* Use raw_ostream throughout the AsmPrinter.Owen Anderson2008-08-211-11/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55092 91177308-0d34-0410-b5e6-96231b3b80d8
* Get raw_ostream.cpp to compile on MSVC.Argiris Kirtzidis2008-08-171-5/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54879 91177308-0d34-0410-b5e6-96231b3b80d8
* add support for a cout/cerr analog (outs()/errs()) as well asChris Lattner2008-08-171-0/+31
| | | | | | | | a simple adaptor class to give raw output capabilities to something that wants to write to an ostream. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54865 91177308-0d34-0410-b5e6-96231b3b80d8
* opening "-" automatically yields stdout.Chris Lattner2008-08-171-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54863 91177308-0d34-0410-b5e6-96231b3b80d8
* rename OutputData to 'write' to match ostream.Chris Lattner2008-08-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54857 91177308-0d34-0410-b5e6-96231b3b80d8
* add a new raw_ostream class which is an extremely high performance ostream thatChris Lattner2008-08-171-0/+64
can *only* output data (no seeking, reading, etc). This is adapted from the clang "-E outputter", and is roughly 10% faster than stdio on darwin and 30% (or more) faster than std::ostream. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54855 91177308-0d34-0410-b5e6-96231b3b80d8