This is an archive of the discontinued LLVM Phabricator instance.

Use ErrorOS for log messages as well as error
ClosedPublic

Authored by sbc100 on Dec 8 2017, 2:14 PM.

Details

Summary

These log messages are also diagnostics so it seems like
they should to the same place as errors and debug
messages.

Without this change when I enable --verbose those messages
go to stdout, but when I enable "-mllvm -debug" those messages
go to stderr (because dbgs() goes to stderr by default).

So I end up having to do this a lot:
lld <args> > output_message 2>&1

Event Timeline

sbc100 created this revision.Dec 8 2017, 2:14 PM
sbc100 updated this revision to Diff 126209.Dec 8 2017, 2:16 PM
  • cleanup
sbc100 edited the summary of this revision. (Show Details)Dec 8 2017, 2:16 PM
ruiu added a subscriber: ruiu.Dec 8 2017, 2:53 PM

I agree that log should go to stderr, but I think message should still go to stdout. We have that function to print out a regular message, such as printing out version information or some hint message. We have this function mainly because we want to acquire the global lock before printing out something in the multithreaded environment.

sbc100 added a reviewer: ruiu.Dec 8 2017, 3:24 PM
sbc100 updated this revision to Diff 126225.Dec 8 2017, 3:24 PM
  • feedback
ruiu accepted this revision.Dec 8 2017, 3:27 PM

LGTM

This revision is now accepted and ready to land.Dec 8 2017, 3:27 PM
sbc100 updated this revision to Diff 126227.Dec 8 2017, 3:45 PM
  • update tests
This revision was automatically updated to reflect the committed changes.