From: Daniel Dunbar Date: Fri, 24 Jul 2009 23:04:51 +0000 (+0000) Subject: CodingStandards: Emphasize use of raw_ostream more. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e8530a3d8c940fb7710be7e25098b5c3b2c2de19;p=oota-llvm.git 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 --- diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index 2068c0f2c5a..2d83f0bf62a 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -57,6 +57,7 @@
  • #include <iostream> is forbidden
  • Avoid std::endl
  • +
  • Use raw_ostream
  • Microscopic Details @@ -907,9 +908,9 @@ library. There are two problems with this:

    example) is allowed normally, it is just <iostream> that is causing problems.

    -

    The preferred replacement for stream functionality is the -llvm::raw_ostream class (for writing to output streams of various -sorts) and the llvm::MemoryBuffer API (for reading in files).

    +

    In addition, new code should always +use raw_ostream or +the llvm::MemoryBuffer API (for reading in files).

    @@ -938,6 +939,26 @@ it's better to use a literal '\n'.

    + + + +
    + +

    LLVM includes a lightweight, simple, and efficient stream implementation +in llvm/Support/raw_ostream.h which provides all of the common features +of std::iostream. All new code should use raw_ostream instead +of iostream.

    + +

    Unlike std::iostream, raw_ostream is not a template and can +be forward declared as class raw_ostream. Public headers should +generally not include the raw_ostream header, but use forward +declarations and constant references to raw_ostream instances.

    + +
    + +