[clang] NFC: Use flush() idiomatically
authorKirill Bobyrev <kbobyrev@google.com>
Wed, 26 Jan 2022 17:24:37 +0000 (18:24 +0100)
committerKirill Bobyrev <kbobyrev@google.com>
Wed, 26 Jan 2022 17:24:38 +0000 (18:24 +0100)
commita2fe81f32c3a2772e49cb5555d5978db4e5812a3
tree0786bf40e35f3370e0470934ac4946a7bff42a8a
parentcbd0822f2730e2b0d5f1c44b645609fe9554f58e
[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
clang/lib/AST/DeclPrinter.cpp