r315950 - Replace usage of std::stringstream with raw_string_ostream

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 16 15:47:26 PDT 2017


Author: erichkeane
Date: Mon Oct 16 15:47:26 2017
New Revision: 315950

URL: http://llvm.org/viewvc/llvm-project?rev=315950&view=rev
Log:
Replace usage of std::stringstream with raw_string_ostream

Typically we don't use the stringstream, so instead use
raw_string_stream.  Additionally, the dependent function
changed to use raw_ostream.

Modified:
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=315950&r1=315949&r2=315950&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Mon Oct 16 15:47:26 2017
@@ -2998,7 +2998,7 @@ static bool isArgVariadic(const Record &
   return createArgument(R, AttrName)->isVariadic();
 }
 
-static void emitArgInfo(const Record &R, std::stringstream &OS) {
+static void emitArgInfo(const Record &R, raw_ostream &OS) {
   // This function will count the number of arguments specified for the
   // attribute and emit the number of required arguments followed by the
   // number of optional arguments.
@@ -3471,7 +3471,8 @@ void EmitClangAttrParsedAttrImpl(RecordK
   // another mapping. At the same time, generate the AttrInfoMap object
   // contents. Due to the reliance on generated code, use separate streams so
   // that code will not be interleaved.
-  std::stringstream SS;
+  std::string Buffer;
+  raw_string_ostream SS {Buffer};
   for (auto I = Attrs.begin(), E = Attrs.end(); I != E; ++I) {
     // TODO: If the attribute's kind appears in the list of duplicates, that is
     // because it is a target-specific attribute that appears multiple times.




More information about the cfe-commits mailing list