This is an archive of the discontinued LLVM Phabricator instance.

[Support] raw_ostream << Error&& and formatv(..., Error&&) consume the Error.
AbandonedPublic

Authored by sammccall on Jul 10 2018, 6:55 AM.

Details

Reviewers
zturner
lhames
Summary

This makes <<, to_string, and formatv behave like the current llvm::toString (in Error.h).

Because of this, we can unify the behavior of llvm::toString with
llvm::to_string, and deprecate the former.

This patch is an alternative to D49013, I think I prefer this one.

(Currently the strings aren't exactly the same for no good reason. Deprecating toString may not be the right thing to do. Not sure the tests are organized right. I'm flexible on any of these details)

Diff Detail

Event Timeline

sammccall created this revision.Jul 10 2018, 6:55 AM
sammccall updated this revision to Diff 154793.Jul 10 2018, 6:57 AM

Remove some noise

sammccall edited the summary of this revision. (Show Details)Jul 10 2018, 7:06 AM
sammccall added reviewers: zturner, lhames.
sammccall abandoned this revision.Jul 11 2018, 12:24 AM

As pointed out on D49013, this doesn't work for formatv, as the behavior is different when printing 0/1/2 times.

This approach could still be used to merge toString/to_string if that's desirable.