HomePhabricator

[LibTooling] Change Transformer's TextGenerator to a partial function.

Description

[LibTooling] Change Transformer's TextGenerator to a partial function.

Summary:
Changes the signature of the TextGenerator std::function to return an Expected<std::string>
instead of std::string to allow for (non-fatal) failures. Previously, we
expected that any failures would be expressed with assertions. However, that's
unfriendly to running the code in servers or other places that don't want their
library calls to crash the program.

Correspondingly, updates Transformer's handling of failures in TextGenerators
and the signature of ChangeConsumer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D61015

Details

Committed
ymandelApr 30 2019, 9:48 AM
Differential Revision
D61015: [LibTooling] Change Transformer's TextGenerator to a partial function.
Branches
Unknown
Tags
Unknown