From: Daniel Dunbar Date: Fri, 24 Jul 2009 23:04:51 +0000 (+0000) Subject: CodingStandards: Emphasize use of raw_ostream more. X-Git-Tag: llvmorg-2.6.0~2407 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fcd54f73bf465f9fa7a820344642f848b5285a3b;p=platform%2Fupstream%2Fllvm.git CodingStandards: Emphasize use of raw_ostream more. - Chris, please approve. llvm-svn: 77010 --- diff --git a/llvm/docs/CodingStandards.html b/llvm/docs/CodingStandards.html index 2068c0f2c5a1..2d83f0bf62a6 100644 --- a/llvm/docs/CodingStandards.html +++ b/llvm/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.

    + +
    + +