kbobyrev created this revision.
kbobyrev added a reviewer: kadircet.
kbobyrev requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Using both `raw_ostream::flush()` and `raw_ostream::str()` consecutively is
redundant. The alternatives are:

- Use `raw_ostream::str()` without `raw_ostream::flush()`
- Use `raw_ostream::flush()` and then use the destination for `raw_ostream` 
writer

The latter is more idiomatic, so the fix resolves this particular case in its
favor.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118247

Files:
  clang/lib/AST/DeclPrinter.cpp


Index: clang/lib/AST/DeclPrinter.cpp
===================================================================
--- clang/lib/AST/DeclPrinter.cpp
+++ clang/lib/AST/DeclPrinter.cpp
@@ -588,7 +588,7 @@
   }
   EOut << " ";
   EOut.flush();
-  Out << EOut.str();
+  Out << Proto;
 }
 
 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {


Index: clang/lib/AST/DeclPrinter.cpp
===================================================================
--- clang/lib/AST/DeclPrinter.cpp
+++ clang/lib/AST/DeclPrinter.cpp
@@ -588,7 +588,7 @@
   }
   EOut << " ";
   EOut.flush();
-  Out << EOut.str();
+  Out << Proto;
 }
 
 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D118247: [clang] NF... Kirill Bobyrev via Phabricator via cfe-commits

Reply via email to