[Support] Don't tie errs() to outs() by default
This reverts part of D81156. Accessing errs() concurrently was safe before and racy after D81156. (`errs() << 'a'` is always racy) Accessing outs() and errs() concurrently was safe before and racy after D81156. Don't tie errs() to outs() by default to fix the fallout. llvm-dwarfdump is single-threaded and opting in the tie behavior is safe.
This commit is contained in:
@@ -878,7 +878,6 @@ raw_fd_ostream &llvm::outs() {
|
||||
raw_fd_ostream &llvm::errs() {
|
||||
// Set standard error to be unbuffered and tied to outs() by default.
|
||||
static raw_fd_ostream S(STDERR_FILENO, false, true);
|
||||
S.tie(&outs());
|
||||
return S;
|
||||
}
|
||||
|
||||
|
||||
@@ -606,6 +606,10 @@ static std::vector<std::string> expandBundle(const std::string &InputPath) {
|
||||
int main(int argc, char **argv) {
|
||||
InitLLVM X(argc, argv);
|
||||
|
||||
// Flush outs() when printing to errs(). This avoids interleaving output
|
||||
// between the two.
|
||||
errs().tie(&outs());
|
||||
|
||||
llvm::InitializeAllTargetInfos();
|
||||
llvm::InitializeAllTargetMCs();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user