]> granicus.if.org Git - clang/commit
[LibTooling] Change Transformer's TextGenerator to a partial function.
authorYitzhak Mandelbaum <yitzhakm@google.com>
Tue, 30 Apr 2019 16:48:33 +0000 (16:48 +0000)
committerYitzhak Mandelbaum <yitzhakm@google.com>
Tue, 30 Apr 2019 16:48:33 +0000 (16:48 +0000)
commitf62caab5336554b0c4389a72a5684b98bc63d4b3
treee9ad260b8b0399742744e8db8c04a8168bae40f5
parent6332c523cd84170619dbeac19f6204f8eb1d668d
[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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359574 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Tooling/Refactoring/Transformer.h
lib/Tooling/Refactoring/Transformer.cpp
unittests/Tooling/TransformerTest.cpp