This is an archive of the discontinued LLVM Phabricator instance.

[Support][CommandLine] Make it possible to get error messages from ParseCommandLineOptions when ignoring errors.
ClosedPublic

Authored by ioeric on Mar 13 2017, 7:41 AM.

Details

Summary

Previously, ParseCommandLineOptions returns false and ignores error messages
when IgnoreErrors. It would be useful to also return error messages if users
decide to check parsing result instead of having the program exit on error.

Event Timeline

ioeric created this revision.Mar 13 2017, 7:41 AM
ioeric added a reviewer: rnk.Mar 14 2017, 1:40 AM
ioeric updated this revision to Diff 91683.Mar 14 2017, 1:52 AM
  • updated comment.
rnk added inline comments.Mar 14 2017, 10:41 AM
lib/Support/CommandLine.cpp
2182

Use raw_null_ostream instead.

unittests/Support/CommandLineTest.cpp
303

Use raw_null_ostream, here and below.

Actually, can you pick one or two unit tests and test that we get an error message in the error stream?

ioeric updated this revision to Diff 91754.Mar 14 2017, 11:19 AM
ioeric marked an inline comment as done.
  • Addressed review comments.
rnk accepted this revision.Mar 14 2017, 11:26 AM

lgtm

This revision is now accepted and ready to land.Mar 14 2017, 11:26 AM
This revision was automatically updated to reflect the committed changes.