[clang] a2fe81f - [clang] NFC: Use flush() idiomatically
Kirill Bobyrev via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 26 09:24:58 PST 2022
Author: Kirill Bobyrev
Date: 2022-01-26T18:24:38+01:00
New Revision: a2fe81f32c3a2772e49cb5555d5978db4e5812a3
URL: https://github.com/llvm/llvm-project/commit/a2fe81f32c3a2772e49cb5555d5978db4e5812a3
DIFF: https://github.com/llvm/llvm-project/commit/a2fe81f32c3a2772e49cb5555d5978db4e5812a3.diff
LOG: [clang] NFC: Use flush() idiomatically
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.
Reviewed By: kadircet
Differential Revision: https://reviews.llvm.org/D118247
Added:
Modified:
clang/lib/AST/DeclPrinter.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp
index 715da7e0d90c5..c3f1d1544f79a 100644
--- a/clang/lib/AST/DeclPrinter.cpp
+++ b/clang/lib/AST/DeclPrinter.cpp
@@ -588,7 +588,7 @@ static void printExplicitSpecifier(ExplicitSpecifier ES, llvm::raw_ostream &Out,
}
EOut << " ";
EOut.flush();
- Out << EOut.str();
+ Out << Proto;
}
void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
More information about the cfe-commits
mailing list