diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 23:04:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-24 23:04:51 +0000 |
commit | e8530a3d8c940fb7710be7e25098b5c3b2c2de19 (patch) | |
tree | 7a939551e2368a60abdf63a8de319ef0f3c47881 /docs/CodingStandards.html | |
parent | 67efc56b80fe47831478a1ea1730d700cef1a411 (diff) | |
download | external_llvm-e8530a3d8c940fb7710be7e25098b5c3b2c2de19.zip external_llvm-e8530a3d8c940fb7710be7e25098b5c3b2c2de19.tar.gz external_llvm-e8530a3d8c940fb7710be7e25098b5c3b2c2de19.tar.bz2 |
CodingStandards: Emphasize use of raw_ostream more.
- Chris, please approve.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77010 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs/CodingStandards.html')
-rw-r--r-- | docs/CodingStandards.html | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index 2068c0f..2d83f0b 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -57,6 +57,7 @@ <li><a href="#ll_iostream"><tt>#include <iostream></tt> is <em>forbidden</em></a></li> <li><a href="#ll_avoidendl">Avoid <tt>std::endl</tt></a></li> + <li><a href="#ll_raw_ostream">Use <tt>raw_ostream</tt></a</li> </ol></li> <li><a href="#nano">Microscopic Details</a> @@ -907,9 +908,9 @@ library. There are two problems with this:</p> example) is allowed normally, it is just <tt><iostream></tt> that is causing problems.</p> -<p>The preferred replacement for stream functionality is the -<tt>llvm::raw_ostream</tt> class (for writing to output streams of various -sorts) and the <tt>llvm::MemoryBuffer</tt> API (for reading in files).</p> +<p>In addition, new code should always +use <a href="#ll_raw_ostream"><tt>raw_ostream</tt></a> or +the <tt>llvm::MemoryBuffer</tt> API (for reading in files).</p> </div> @@ -938,6 +939,26 @@ it's better to use a literal <tt>'\n'</tt>.</p> </div> +<!-- _______________________________________________________________________ --> +<div class="doc_subsubsection"> + <a name="ll_raw_ostream">Use <tt>raw_ostream</tt></a> +</div> + +<div class="doc_text"> + +<p>LLVM includes a lightweight, simple, and efficient stream implementation +in <tt>llvm/Support/raw_ostream.h</tt> which provides all of the common features +of <tt>std::iostream</tt>. All new code should use <tt>raw_ostream</tt> instead +of <tt>iostream</tt>.</p> + +<p>Unlike <tt>std::iostream</tt>, <tt>raw_ostream</tt> is not a template and can +be forward declared as <tt>class raw_ostream</tt>. Public headers should +generally not include the <tt>raw_ostream</tt> header, but use forward +declarations and constant references to <tt>raw_ostream</tt> instances.</p> + +</div> + + <!-- ======================================================================= --> <div class="doc_subsection"> <a name="nano">Microscopic Details</a> |