[PATCH] D81525: [Support] Initialize outs() errs() nulls() once

Sam McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 02:41:38 PDT 2020


sammccall added a comment.

In D81525#2084348 <https://reviews.llvm.org/D81525#2084348>, @jhenderson wrote:

> That being said, is there an issue even if we change the default that somebody could manually tie `errs()` to `outs()`? The user has to make sure the initialisation order is either amenable, or that they have untied things before destruction occurs.


Yup, in fact IIUC C++17 guarantees that `errs().tie(&outs())` executes in the "wrong" order.

Is it important to support initializing errs but not outs? The static initializer for errs could initialize outs too, in the right order. This "only" breaks silly people who tie the other way.

In any case this is subtle enough (with user-provided streams) that tie() should probably document it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81525/new/

https://reviews.llvm.org/D81525





More information about the llvm-commits mailing list